let files run through the flow in a defined arranged order

Post Reply
gkapaurer
Newbie
Posts: 7
Joined: Fri Jul 22, 2016 11:42 am

let files run through the flow in a defined arranged order

Post by gkapaurer »

Hello,

I have a workflow which recieves a pdf with x number of pages.
I split the pdf into single pdffiles and index them.

Now i want to change the jobname into a unique id, but my problem is that switch
does not use my index.

Switch seems to randomly choose the files which it is passing through the next directory.
How can i force swith to use a defined arranged order?


for example:
-->PDF "test.pdf" with 3 pages is imported
--> pdf is splitted and renamed into test_01.pdf, test_02.pdf, test_03.pdf;

--> Now I check a parameter and to label the pdf with "unique id":
Label_01_test_01.pdf
Label_01_test_02.pdf
Label_02_test_03.pdf
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: let files run through the flow in a defined arranged order

Post by gabrielp »

I guess I don't understand the problem since PDF split seems to do this. Can't you strip the index from the file name after the PDF split by taking it off the file name proper after "_"?
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
lombert
Member
Posts: 167
Joined: Fri Feb 04, 2011 2:31 pm
Location: Sweden

Re: let files run through the flow in a defined arranged order

Post by lombert »

I have noticed that if I separated a pdf in to page it is not neccesery the correct page order that gets later in a flow. And I think that is becuse some page is larger than other.so if eg page 1 is bigger than page 2 (in MB), then page 2 cames first sometime.. Has nothing to do with the name..

If you put an hold after the pdf-split and make it to release the file in order and make a short hold time, then you have the flow to process the files in correct order..
Between jobs!
ThomasDeschamps
Member
Posts: 21
Joined: Wed Jul 20, 2016 12:03 pm

Re: let files run through the flow in a defined arranged order

Post by ThomasDeschamps »

If i understand well, you want the file in a certain order of time, first pages of document, first out.

Assemble job just before the output (in order to be sure that the file will go to the output nearly at the same time, if multiple document go trough the flow or if post processing is done after the split) then put a hold with time setting by a variable data (section number in second).

You can also give a look to the priority system.
gkapaurer
Newbie
Posts: 7
Joined: Fri Jul 22, 2016 11:42 am

Re: let files run through the flow in a defined arranged order

Post by gkapaurer »

Hello,

Switch chooses randomly which file proceeds.

I tried "hold job" after split pdf, but it did not work for me.
All files are in an subfolder, so I used "Hold Job" after disassemble job.


Now I tried to use:

--> assemble the job again
--> wrote a javascript which can sort the files.

Now I search for a way to rename the files in the javascript.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: let files run through the flow in a defined arranged order

Post by gabrielp »

gkapaurer wrote:Now I search for a way to rename the files in the javascript.
I would think the easiest way in scripter would be to create a new path with a given name, then use s.copy to copy the contents to that new path, then route it out to a sendTo function.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
gkapaurer
Newbie
Posts: 7
Joined: Fri Jul 22, 2016 11:42 am

Re: let files run through the flow in a defined arranged order

Post by gkapaurer »

Hi,
@gabrielp thx, this idea is great, but I changed the process to an an xml file,
so I can add some Information later.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<root>
<datei lfdnr="1">001_Neu.pdf</datei>
<datei lfdnr="1">002_Alt.pdf</datei>
<datei lfdnr="2">003_Neu.pdf</datei>
<datei lfdnr="2">004_Alt.pdf</datei>
<datei lfdnr="3">005_Neu.pdf</datei>
<datei lfdnr="3">006_Alt.pdf</datei>
</root>
Now I import the xml with the pdf, but my job rename script always brings "undefined" instead of 1,2 or 3.
Datasetname = "zuordnung"

Code: Select all

 _retval = job.getVariableAsString('[Metadata.Text:Path="/root/datei[text() = /"001_Neu.pdf/"]@ lfdnr",Dataset="zuordnung",Model="XML"]');
_retval += "_"				
job.log(-1,_retval);
_retval;
Post Reply