Wappler Version : 2.5.5
Operating System : Mac OSX Mojave v10.14.5
groupBy.php.zip (1.3 KB)
Hi all,
I have attached the server action file (uses public api sample data) for the below bug report.
Details
-
I have an public api that returns a dataset which is an array of objects
-
The api data is assigned to variable
array_of_objects1
, output is printed -
The api data is also put through a repeat and the two properties of each object is printed
The output of both steps 2 & 3 are exactly the same:
[{
"name": "dept1",
"staff": "john"
}, {
"name": "dept1",
"staff": "jack"
}, {
"name": "dept2",
"staff": "joe"
}, {
"name": "dept3",
"staff": "jim"
}]
.
In the last two steps, I tried using the groupBy formatter on the above two “array of objects”:
-
When the groupBy is tried on the variable
array_of_objects1
that holds the api data, I’m getting the following error: -
When the groupBy is tried on the repeat
array_of_objects2
that outputs the same data, the group by seems to work just fine. The output prints correctly as["dept1","dept2","dept3"]
It’s exactly the same data, while the groupBy formatter works on a repeat output (step-3, which is my current workaround), its not working directly on api returned data (expected & ideal).
Also, not sure if this issue is only with the groupBy formatter not working on api-returned “array of objects”.
Last updated: