Forum Academy Marketplace Showcase Pricing Features

Use API to get updated records but then filter what ones go into db

How would I do this:

Lets say I have a db that stores appointments:

Start time, person name,AppointmentUID

I do an api call and I get a list of 10 appointments with the properties mentioned above.

HOW:
Now that the api has received the 10 appointments I need to:
-loop through them and check:
---- Does the appointment already exists?
--------It does not exist in current db = save it to db
--------it does exist in current db = check the details are the same, if they are not then UPDATE the fields that have changed.

===========================================
Visual example:
Let’s say on 1/1/2023 I have the following appointments in my db:
(name, appointment UID, start time)
-Sam, 00001, 1:00
-Jack, 00002, 2:00
-Tom, 00003, 3:00
-Kim, 00004, 4:00

Now I call api on that same day to get all appointments, the API returns:
-Sam, 00001, 1:00
-Jack, 00002, 2:20
-Tom, 00003, 3:00
-Kim, 00004, 4:00
-Zack, 00005, 6:00

As you see we have no change on:
Sam
Tom
Kim.

We have a chance on:
Jack

We have a new record:
Zack

Need to not update Sam, Tom, Kim
Need to update Jack’s start time
Need to add Zacks appointment to db

Help :smiley:

@mikeloc @J805
Would you be so kind to help a struggling young man :smiley:

1 Like

Hey @TomIsCool :wave:

I would suggest running a backend workflow with an iteration number to loop through each one and check those values.

Here is a paid video if you don’t know how to do a loop. NoCodeMinute - eLearning Hub

Hope that helps. :blush:

Is this a backend workflow or client?

currently client - couldnt get backend working