How to compare 2 database ID's and update

Options
Hi Guys,

I have the following scenario.

Database1: database gets products based on external api
Database2: core database with our products.

What I want to do is to update the core database 2 with information from database 1, IF the id from database 2 is present in database 1.

Currently I have the following expression that validates if an ID from database 2 is present in database 1 and returns true or false.  That works.

But now I want to update the values in database 2 with values of database 1 if it's true. However, the following in the screenshot is not working.

What am i missing here?

Alternatively... is this the smartest way of doing it? or is there perhaps a better way to achieve my scenario?[download (2).png]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hi  - it sounds like you will want to have two For Each Loops for what's being described, something similar to this:

    Query all records from Table 1
    For Each Loop through Table 1
    -Query All records from Table 2
    -For Each Loop through Table 2
          -Conditional If each ID of table 2 = each x field of table 1 
  • wtzr
    wtzr Member
    Options
    Thanks Michael, 

    In the end i was able to solve this with one for each loop. 

    Is it common for Xano to be unable to provide debugging information if you use multiple for each loops? In my case it had to loop through 360 items in both databases. But it was already unable to provide that info. (i did not had any conditions in those loops yet)
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    It just depends on the amount of data - the debugger's data has a limit in order to not affect the Run portion for testing
  • wtzr
    wtzr Member
    Options
    got it. 

    All works smoothly now. thanks for the support!