Good Day all,
This bug has recently crept in, when retrieving the “Default Farm” and returning all relations, the API is only returning 6 item for Areas.Camps when there are in fact “38”
Area
As Always your assistance is appreciated.
Kind Regards,
Raymond
Hello @Raymond_Woodley,
could you please provide your app id?
App Id: 11A796DF-2904-B69D-FF6C-1963FA4C3F00
Thanks.
You have 38 objects of Areas
relation (the objects in Areas
tables), not the Areas.Camps
. If you looking for Areas objects, you need to specify Areas
in the relations list.
I understand that yet it returns Areas plus camps as it should
I have narrowed the glitch down to a variable issue,
I tried to reproduce it with, here is a URL:
https://your-domain.backendless.app/api/data/Farm?where=objectId%20%3D%20%27B0648C43-E483-4B94-92A4-F540403A295F%27&loadRelations=Areas.Camps%2CGroups%2CGroups.Allocation%2CRegression%2CSilos%2CGroups.Allocation.Camps%2CGroups.Allocation.Camps.Latest_Pasture_Walk%2CAreas.Camps.Latest_Pasture_Walk%2CPlatform&relationsPageSize=100&relationsDepth=10&pageSize=1
It gives me a result with 38 Area objects.
I also created a demo page in your app to reproduce your issue and demonstrate the results:
https://develop.backendless.com/app/YOUR_APP_NAME/ui-builder/default/pages/backendless_support
(Open the browser’s console to see results).
As you can see, it returns all 38 objects.
What i find confusing is this yields two different results.
The resolution of the screenshots is too small and hard to see. Could you re-upload it in higher resolution, please?
Another Strange thing i found was this says 38 items in the list yet only 5 in the json
Thanks.
The API is working correctly, I hope we both agree on that.
The problem starts after the result has been set to the current user.
It’s difficult for me to say what happens between this value is set to the user and when it is output to the log. But from what I see it looks like there is some logic that mutates this object afterwards, filtering the Areas list.
I would search this way.
I have found the offending code but can’t see why it would cause an issue.
That is the issue - this code mutates the original object by reference and as a result, you see modified data in logs.
If you want to keep the original object unmodified, you may want to create a new Remaining Areas list consisting of needed values instead of filtering the list by reference (as currently).
Thank you @stanislaw.grin
Using your suggestion i did the following which has now worked.
I thought by creating a variable this issue would have been avoided.
Kind Regards,
Raymond
1 Like