I’m requesting data from an API that includes changes within a 48 hour period. As the Make scenario is querying the API every 3 hours, the response may include records already processed by the scenario on a previous occasion.
To combat this I have setup a Data Store which, on completion of the scenario, will store the Patient ID number of the subject whose data is being processed. In the scenario I want to query the Data Store to see if the subject’s Patient ID number exists in the Data Store. If not, the scenario should continue. If it exists in the Data Store the scenario should stop.
Here is my current flow:
Here is the filter:
I have tried retrieving all results and then checking if stored Patient ID equals the Patient ID of this iteration but this results in the next step being completed multiple times. I’ve tried seeing if the Data Store result array contains the Patient ID but that doesn’t seem to work either.
Hi. Store the Patiend ID as an array in datastore. Then you can use the filter using the rule (with string function) “IF patient ID array” DO NOT CONTAINS patient id Interated". This way only the interated not present in the datastore array will go to the next steps.
If you have questions reach out
Thanks @Wemakefuture for the suggestion. I’m not sure that would help as then I’d have lots of arrays I would have to search through in the Data Store. I’m really after an option like
SELECT 1 FROM `data_store` WHERE `patient_ID` = 'patient:id'
Then if number of rows returned is > 0 the scenario would not proceed.
@DrMatt - Did you ever figure this out?
I have had success in the past using ‘check the existence of a record’ (data store module) - and then setting up a router, where 1 path proceeds if ‘Exists’ is equal to ‘false’
The only problem I have with this solution, it requires the patient id to be the key (using language from your example).
So to answer your question on how to use the ‘search records’ module (which is much more flexible in how to search the data store) - make sure you select the ‘show advanced settings’ - then make sure to check ‘yes’ for the continue execution of the route even if the module returns no results.
Then just setup a filter that checks if a value from the data store search (I don’t think it matters which field/value) exists (or in our case does not exist)
I hope this helps, and I am only responding because I had the same question, I couldn’t find the answer on community, but through some trial and error I got it working so I thought I would post here for fellow makers in the future.
Thanks for your input. I might give this a go. I had just given up and gone back to using Zapier even though it wasn’t my preferred option!
Hi @DrMatt happy Friday
When you have a bit of time to check out the solution proposed by @Joseph_Accountant could you let us know whether or not it worked for you? We’re eager to know if it did the trick and if the community can help you with anything else.
In case anyone is still interested I found that checking for existence of the key after a Datastore search on another value, like your patient_id, worked with the router as you describe: