Page 1 of 1

Hold until variable number of files

Posted: Thu Nov 14, 2019 3:02 pm
by Terkelsen
I'm searching for a way to hold a file until the destination folder holds a variable number of files. The variable number can be found as metadata in the file to be released.

To be more specific. A CSV file is coming into the flow. I'm counting the number of rows in that CSV file and writing it into Private Data by using the app Count Rows. This file has to be sent to a specific folder, only when that folder holds a number of PDF-files that is equal to the number of rows in the CSV file.

If you set the HoldJob element property for Folder constraint to Yes, you are able to define a Maximum job count as a fixed number. I would like to be able to define an Exact job count and define it as a variable. :roll:

Re: Hold until variable number of files

Posted: Thu Nov 14, 2019 3:10 pm
by jan_suhr
Check the outgoing connection property Folder constraint of th eHold Job element.

It will allow you to count the number of files in a specific folder and set conditions to release the job on hold. The folder can be outside of the flow with the Hold

Re: Hold until variable number of files

Posted: Thu Nov 14, 2019 4:26 pm
by Terkelsen
But Jan, that only allows me to set a maximum number as opposed to a minimum number of files and it only allows a fixed number, not a variable.

Re: Hold until variable number of files

Posted: Thu Nov 14, 2019 6:11 pm
by essexmate
You can use the Hold job groups app or Assemble Jobs and define the number of files as a variable with private data.

If you want to wait for the same amount of PDF files as your csv counted row private data, define the number of files with a switch calculation: [Switch.Calculation:Expression="[Job.PrivateData:Key="RowCount"]+1"] with the +1 being the csv file itself.

Re: Hold until variable number of files

Posted: Fri Nov 15, 2019 9:46 am
by Terkelsen
Thank you for the suggestion, Essexmate. That is a different approach to place the Excel file in the folder right from the beginning and then move everything when the number of files is reached. However, I see three problems with that solution.
  • In this case we are talking about several thousands of PDF files. I would rather not move all these files in Switch if I can prevent it.
  • Only the Excel file holds the private date about the number of rows. I’m not sure if Hold Groups or Assemble Jobs can react on metadata in only one out of thousands of files? I could of course export that metadata and pick it up on all the PDFs but that again will involve moving all files.
  • An external process is triggered as soon at the Excel file arrives in the folder holding the PDF files. If all files including PDF and Excel are moved I can’t be sure that the Excel file will be the last one arriving.

Re: Hold until variable number of files

Posted: Fri Nov 15, 2019 5:39 pm
by Terkelsen
Update. A good friend wrote me a script to use as Release condition in the Hold element, and that works perfect ;)

Re: Hold until variable number of files

Posted: Wed Jan 15, 2020 1:38 am
by ckuhlmannHP
I am looking to do something very similar, would you be willing to share the script your friend provided you?

Thanks