I want to fill the local data source with the data from the api response but before adding i want to check if 2 values exists or not if 2 values exists in row dont add if not add data
I’m having trouble understanding what you’re trying to do. Can you give some specific examples?
I have an API that sends JSON data containing username, server, port, password, and version. In my local Thunkable database, I have created tables to store this data. I want to sync the API data with my local database while avoiding duplicates. The way I want to validate duplicates is by checking two values: username and server. If an incoming record has the same username and server as an existing record in my database, it should not be synced. How can I implement this validation in Thunkable?
You’ll need to:
- Get the two values from the API data
- Get the two values from the local data source
- Compare each of the two values and if they are not both the same, add the API “row”/record to the local data source
The current API response is:
[{"username":"Test","server":"astcart.shop","port":25565,"version":"1.20.1","password":"Samir","enabledPlugins":[]},{"username":"Test2","server":"Astcart.shop","port":25565,"version":"1.21.1","password":"77889900","enabledPlugins":["Test"]},{"username":"Samir","server":"Samir","port":"25565","password":"888283","version":"1.21"}]
You would loop through the array by using a for each item j in app variable bots, like you have in the screenshot. In that loop, check to see if the list of values in the username column of your local data source contains the property “username” of the object j. Also check for the server. Then sync if necessary.
Can you make a example i am a complete beginner to thunkable and i didnt find and example codes online