When an item is tapped it adds it to the first list. and the list continues populating. Once done the total list needs to be uploaded to an API by clicking on the submit button.
The problem is I don’t find a loop that I can use to upload each item to the API.
I can replace all but that defeats the purpose because if I do a new list It won’t add the new list of items to the old list.
Is there a way to do an incremental update of a list of items?
The database just stores your data, so it cannot for example evaluate what items are already in the list. This is why incremental changes and other data manipulation have to be made on the app side.
I would make the current list from the API available in a data variable, and use CONCAT() to add the list of new items to the existing list when the Submit button is tapped. Then I would send the updated list to the API.
Thank you. I only have the following problem that is preventing me from continuing. I have triple checked and the objects are identical. Please can you assist?
Hi Ashley, would you still mind posting screenshots of your data resource and client-side resource schemes so I can check them too? If they are identical this error should not pop up.
Hmm, looks fine to me – are you using Get record collection to fetch the client-side data? You should be able to get it with Get Record and the ID you have given to the client-side reserouce. With that and Create Record you should be able to bind the identical resources directly.
So basically what I want to do is add a list of objects to client side datebase:
Product 1
Product 2
Product 3
Product 4
Once this list has been completed a submit button is clicked and it needs to make a copy of this list in another client-side database which uploads the order to the API. This upload function will first check for internet access.
Once the internet access is found it needs to upload each record to the online API.
The biggest problem I have is making a replica client database from the existing single line items that have been added.
Hi! Sorry to jump in and if my answer isn’t on the mark, but sounds like you need to make yourself some looping logic to go through the list of client-side data. I would start with an if node of checking if the objectsToUpload data variable has items in it, and then create the first item in the list into the API, delete the item from objectsToUpload, and then connect that node back to checking if the objectsToUpload data variable has items in it.
Yup, so it sounds like the fields you are passing to create record are not named correctly. You’re using a REST API data source, so you need to check with your backend what fields and format a POST request requires.