How to compare 2 database ID's and update
Options
![wtzr](https://us.v-cdn.net/6037124/user_avatars/2760684.jpg)
wtzr
Member ✭
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]
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
-
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 -
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) -
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
-
got it.
All works smoothly now. thanks for the support!
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