Switch - Assembly "Watchdog" Condition

Post Reply
User avatar
PrepressNinja
Newbie
Posts: 3
Joined: Fri Feb 16, 2018 5:46 pm

Switch - Assembly "Watchdog" Condition

Post by PrepressNinja »

Hello, first post here...sorry for length!

A Switch challenge I run into often is trying to manage global values for assembly.

I have files coming in from multiple directories that need to be assembled into a certain folder structure based off a shared 5-digit job ID#. The challenge is trying to assemble an unknown number of files and directories, so I tried to use private data attached to counters and databases to keep track of how many came through and pass that total to the Assemble. As you may guess, each file gets private data for COUNT, but each one gets tagged differently (1, 2, 3, etc.), so the Assemble takes the value of the first one that gets there (COUNT=1), assembles and stops. With me so far?

I wondered if there was a way to monitor all Switch folders in the flow before the assemble, query them to see if they are empty, (then I know we are done processing), and then tell the Assemble module it's ok to release what it has. If not, is there anything you have used to tackle a similar issue?

I expect I explained this poorly, but I thank you for reading and for any help you're able to share. I'm happy to clarify if needed. :)
▬▬ι═══════ﺤ
loicaigon
Advanced member
Posts: 362
Joined: Wed Jul 10, 2013 10:22 am

Re: Switch - Assembly "Watchdog" Condition

Post by loicaigon »

If you have a clear idea of how many jobs have to be assembled for a certain id, then that would be easy

Say
jobA.pdf
jobB.pdf
jobC.pdf

Those have to be assembled. You would need to know two things : a global id and the number of items to be assembled. If you have those info in the database, you can pull those data and pass them to the assemble job.
Something like
ID:
SELECT orderId FROM myDatabase WHERE jobName IS {The job name from Switch}
COUNT:
SELECT fileCount FROM myDatabase WHERE jobName IS {The job name from Switch}
r.zegwaard
Member
Posts: 93
Joined: Fri Jul 08, 2011 10:31 am
Location: The Netherlands

Re: Switch - Assembly "Watchdog" Condition

Post by r.zegwaard »

You could use a "Set hierarchy path"and "Assemble hierarchy" to create the folders. Use the "set hierarchy path" to add the ID to the hierarchy.
This would work fine if you don't need to process the created folders as a folder-jobs. If you do need them as folder-jobs you might insert the created folders on a time-based interval.
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Switch - Assembly "Watchdog" Condition

Post by Arthur »

I had a similar issue, where each job comprising of tens or hundred of files, was to be assembled in a certain order and under the condition of exact number of files, otherwise the assembled job would not be completed.
What I ended up with is quite lengthy, but it works.
You may need a similar thing your end.

Each folder would need to be counted for the number of files. You may need to Assemble each individual directory and disassemble to get the info on how many files is there. If a job is a JobFolder then it's easier, as the necessary info is available to you without the need for additional assembling/disassembling.
This data would need to be exported to a dataset/xml, for each folder the files are to take part in the final combination separately.
Then you may need to inject those individual datasets/XML to each file from each folder, as you cannot determine which file of those folders gets to the Assembler first, so you need to have the filecount available as a metadata / PD to each single file that you need to be a part of the final assembled job.

In Assemble properties set a condition on the number of required files based on switch calculation using values from the embedded metadata/xml.
Voila. Few loops for the Inject Job may be required, but in the end it shall do the trick.
Post Reply