Hold until variable number of files

Post Reply
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Hold until variable number of files

Post 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:
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Hold until variable number of files

Post 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
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Hold until variable number of files

Post 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.
essexmate
Member
Posts: 30
Joined: Tue Sep 05, 2017 4:41 pm

Re: Hold until variable number of files

Post 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.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Hold until variable number of files

Post 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.
User avatar
Terkelsen
Advanced member
Posts: 297
Joined: Thu Sep 08, 2011 5:08 pm
Contact:

Re: Hold until variable number of files

Post by Terkelsen »

Update. A good friend wrote me a script to use as Release condition in the Hold element, and that works perfect ;)
ckuhlmannHP
Newbie
Posts: 14
Joined: Tue Jan 09, 2018 9:19 pm

Re: Hold until variable number of files

Post by ckuhlmannHP »

I am looking to do something very similar, would you be willing to share the script your friend provided you?

Thanks
Post Reply