Xano adds empty items ID=0 to array instead of leaving it empty []
![Anna Sho](https://us.v-cdn.net/6037124/uploads/userpics/9J2BDR93V3FA/nAMOURF2V6E1B.jpeg)
My record has column "folders" which is array of IDs.
I need to leave it empty if no ID is added, but when I send empty array in my variable with POST enpoint it adds zero-ID record to array [0] but should be empty.
Here is example if I create record manually in table with no items added (0) and when i create item on api call → it adds 1 item
And inside the column this item is just empty but 0
I have fronend logic based on displaying this data if array is not empty but this new behaviour just broke my logic all over application because its never empty!
I tried any ways to send empty array to my variable from frontend like [], or "" or null but nothing works it always adds 0-ID item to array 😰
I tied to do nullable or non-nullable array column but this doesn't help either
Please help! How does this suppose to work??
Answers
-
You can clean up your data in the function stack after the query all records statement. Iterate over the result with a “for…each” and nest an “if-then” which updates “item.folder.labels_id” to a blank array when it is “count” of 1 and the first value is 0.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback