Page 1 of 1
let files run through the flow in a defined arranged order
Posted: Fri Jul 22, 2016 12:02 pm
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
Re: let files run through the flow in a defined arranged order
Posted: Fri Jul 22, 2016 8:22 pm
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 "_"?
Re: let files run through the flow in a defined arranged order
Posted: Sat Jul 23, 2016 11:03 am
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..
Re: let files run through the flow in a defined arranged order
Posted: Mon Jul 25, 2016 8:59 am
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.
Re: let files run through the flow in a defined arranged order
Posted: Mon Jul 25, 2016 4:04 pm
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.
Re: let files run through the flow in a defined arranged order
Posted: Mon Jul 25, 2016 5:27 pm
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.
Re: let files run through the flow in a defined arranged order
Posted: Mon Jul 25, 2016 6:38 pm
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;