Best practice for keeping a tally of items?

Hello,

I have a DB table with paths to physical files. I read the table and then iterate through each row to copy file to a certain folder.

for some rows, even though a filename is listed in the DB, it doesn’t exist on the filesystem. I managed to make it work, but I want to keep a list of names for such missing/failed rows.

What I did was to create a Set node; with 3 variables,
countSuccess
countError
listError

in my SplitInBatches, I check the existence and depending on that, I update these values like this:
$node[“SetVars”].json[“countError”] = $node[“SetVars”].json[“countError”] + 1
and similar.

Then I use this nodes values in the end to mail the resulting log.

Is there a better way to do this?

Hey @Bahadur!

It seems that workflow is fine. I am just curious how are you adding the name of files that are not present? Is there a node doing that (sorry, I couldn’t find a node doing that does that in your explanation). You can also use the IF node to check the condition and perform actions based on the output.

Hello @harshil1712 ,

I am using IF after Read File to check for file existence; what I was wondering about was how to keep a list of items rather than using a Set node