Return only Ids that have not been checked

Hi again!
I have a flow that when ran, checks for a certain string from a table via mssql, then spits the alert out in the form of an email. That all works fine. However, I don't want it to keep sending out the same one. Each string also has a unique ID associated with it. So, I would like for it to check for this UID, if it's already sent an alert on it, then ignore, if it's new, then send the alert. Any thoughts for accomplishing this?

Use a filter node?

Put a date time field "alerted"in the database table and update it after you sent the alert?

1 Like

If you are sequential all you need is a function node with a context var that stores the last id you sent out. Then do an if statement to check if its equal to the last one and if not overwrite it again with the new value.
For example:

On node start tab :


On node msg:

prev_id = context.get("prev_id");
curr_id = msg.payload;

If(prev_id != curr_id){
//mail stuff
Return msg;

Thanks znetsixe, that works!

1 Like