Xano adds empty items ID=0 to array instead of leaving it empty []

Options

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??

Tagged:

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    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.