OK, the first step was resolved, it turned out that a new problem arose, because I used a timer block to retrieve data every hour and I used a bulk create block, so every hour the incoming data will be duplicated. what I hope is that only new data will be collected every hour, excluding data that has already been retrieved. What should I do?
Use bulk upsert.
Hereās info about the upsert operation:
IMPORTANT; You will need to rename the āIdā property to āobjectIdā before objects are upserted into the database
Thanks again Mark, Iāve managed to fetch data from external API from time to time easily.
Hi @Mark_Piller,
Previously, I had successfully implemented a bulk upsert to retrieve data from an external API but it was limited to 100 objects. My question is, is there a way to retrieve more than 100 data from the external API?
thanks for your advice.
Hi, @Iant
You need to have a loop where you can load 100 records with pageOffset until you load all of them. you Can take a look at how itās implemented using Codeless:
Regards,
Marina
Hi guys, thanks for your help, anyway Iāve tried both of your suggestions aboveā¦ As for the installing logic function, Iāve done it but Iām confused about how to apply it because I canāt find it in the list of functions. (in the timer logic editor) As for what @Marina suggested I have also tried applying it to my case (upsert data from an external database) but something was missing when connecting pageOffset (data type number could not be connected) and Iām also not sure what i do. Most likely I misunderstood the conceptā¦
Please helpā¦
here is what i have done
I thought that the code block that I built earlier would not possibly work. Instead, I tried the following codeā¦ but it didnāt work too
Hello @Iant
What exactly does not work? Some error? I do not know what do you expect.
You should debug your code with a print block.
I recommend do it in UI-Builder. It is convenient for me to do this because there is a developer panel (F12 for chrome) the select the āConsoleā tab, this is where your logs from print will appear.
Add component a ābuttonā to the page, and add āonClickā logic to the ābuttonā. In āonClickā logic run your func.
Debug:
- Before the cycle add a print block with ādataBaruā (before the green block)
In the cycle do not use block āin list ā¦ addā with ādataBaruā. Just save the result of āLoad Table objectsā in the new variable āloadedObjectsā - After the cycle add the āprintā block with āloadedObjectsā
- Add the āprintā block with the block āIn List (dataBaru) add (loadedObjects)ā
Also, the āBulk Upsertā returns a list of āobjectIdā
Regards
Hi @Victor thanks for your advice, I did what you recommended but havenāt been able to fetch data for more than 100 data objects and store them in a table, but I can already see the data being sent from externalAPI via the payload tab as shown in the following screenshot. What should I do?