I have some logic in a repeater item which involves a “get object by id” block… this block breaks the data model of the repeater somehow. Here’s the logic:
The 1st print statement prints a beautiful objectId. The “Get Object by ID” fails, error says “Cannot read properties of undefined”. If I hard-wire the object ID as text into the “Get Object by ID” block, then the second print statement produces “Cannot read properties of undefined”. Basically, getting an object by ID from the database and assigning to a variable destroys the data model so my “item” object in the repeater is undefined.
I tried reconstructing the logic from scratch and deleting the old statements, to no avail.
AppID is AE4235E1-DBB7-C6F0-FF4A-E0378B0B2B00. Very difficult to reproduce except on this particular logic area. At my wits end, hoping to not loose a lot of work…
Try printing the actual repeater data item to see what it has. It should give you some clues.
Yes, did that. Has a nice object with lots of properties, then it has “undefined” after the “Get Object by Id” runs.
So here is the code where the 1st print prints a nice object, the second one prints “undefined”:
And if you disable the
set in between the prints and put a
wait block (say 700 ms) in there, does the second print work?
Hm… nope, also fails! So it’s not the API call to the database, just something somewhere happening around that time that wipes out my repeater item
Yup, somewhere in your logic you’re wiping out the data…
Found it — thank you so much for the help! The “just put in a wait block to see if it’s something else happening around that time” tip was very helpful, will add it to my repertoire of debugging methods
Edit: just want to add a note here that the support from Backendless is incredibly great. Helping us silly newbies debug our bad code within minutes of me starting a support topic… you (@mark-piller but also ALL the people at Backendless) are very much appreciated