What would go here in this activity?

0
QuestionI'm working with a loop that retrieves drivers from the database using an API. I need help setting up the decision condition to avoid duplicate entries based on dates and names, and to filter out empty driver records.ContextI have an entity with specific attributes that I'm retrieving through an API call within a loop structure.What I NeedGuidance on how to construct the decision condition to:Prevent duplicate records when names and dates matchSkip empty driver recordsIf you can share the entity attributes or a sample record structure, that would help clarify the best approach for your specific case.
asked
1 answers
1

Your current decision expression uses AND, so it only evaluates to true when every attribute is empty at the same time. This is the correct approach if your definition of an “empty driver record” is: AdmissionDate, DriverNo, Name, and IdNumber are all blank/null. In that case, keep the AND logic and route true → skip / continue the loop, false → process the record.


If instead your rule is “skip the record if any key field is missing”, then AND is too strict. For example, if Name is empty but DriverNo is filled, your current expression becomes false and the record will still be processed. In that scenario, use OR for the mandatory fields you care about (for example: Name = empty or DriverNo = empty), and route that path to skip the record.


To prevent duplicates based on Name + AdmissionDate, do a Retrieve from database inside the loop before creating a new Drivers object. Retrieve Drivers with an XPath constraint like:

[Name = $DriverData/Name and AdmissionDate = $DriverData/AdmissionDate]

Store the result in $ExistingDrivers, then add a decision: isEmpty($ExistingDrivers). If it’s empty, create + commit. If it’s not empty, skip (or update the existing record if your requirement is “sync”).


Also watch out for date matching. If AdmissionDate is a DateTime and the API includes different time parts/timezones, exact equality may not match even when the same day is intended. In that case, normalize the value you compare (for example compare only the date part, or compare within the same day range) to avoid accidental duplicates.


If this resolves the issue, please close the topic.


answered