Direct Database Query + Update Variable to add property to object

Options

So I am using a direct database query as a fallback to a Query All Records. Each of these return an array of objects. After either of those steps are hit, I'm adding a new property, distance, to each item in the array. When I do this to the variable from the Query All Records, everything works great and the property is added to each item. However, when I do this to the Direct Database Query, it replaces the entire object with the new property I am adding.

The code and the structure of the array of objects is identical in both cases as is shown in the debugger. Is this a bug?

Answers

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

    Very hard to tell without more data! Can you maybe make a loom or some such to demonstrate your two paths and the different results? Often when I hear these situations, a close look at the results reveals something like one being wrapped in an array, or a situation of nested objects that can be confusing the situation but looks subtle in the JSON outputs and can get missed. A loom lets you put more eyes on it!

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

    thank you for the loom! What I can’t do is understand what should have been in item before the update call. I’d look at the debugger to see what item is at each step within that loop. When does it go wrong? Right now I see it’s wrong at the end but it’s not clear yet why.

    It’s possible there is a big you’ve found, in which case I would leave it to our friends at Xano. But if you look at the intermediary steps, you might find a cause in the stack or hints that could help us find a workaround.

    if you post an update loom here we might make progress on the forum over the weekend! If you can, please be expansive in showing screens of logic and what is in the variables. The loom lets us pause on key screen reveals without requiring you to dwell on them.

    This looks like a neat puzzle- hope we can help you solve it!