Add fixed length numerical value as Private Data or suffix

Post Reply
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Add fixed length numerical value as Private Data or suffix

Post by LasseThid »

I have a flow where I need to pick up files from an archive and assemble them in the order they are in the csv file provided by the customer.
I get the position from the name of the xml created by CSV2XML and add that to the file name by adding it as a suffix to the file name.
However, when I do the Merge PDF the page order is 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8 and finally 9. I'm guessing this is due to the fact that the length of the suffix is 1 for some files and 2 for some files. Is it possible to somehow add leading zeros to the suffix either when I place it in the Private data or when I add it as a suffix?

Thanks in advance
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Add fixed length numerical value as Private Data or suffix

Post by Arthur »

Search & Replace -> RegEx ??
Search ^(\d{1})(_)(.*)
replace 0\1\2\3 ??
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Add fixed length numerical value as Private Data or suffix

Post by LasseThid »

Thanks Arthur.

Will that work with a file name looking like this?

P123456_1_flying-elephant-100x70-1.pdf

I solved it by using three different Rename job and branching them higher than 99, lower than 100 AND higher than 9 and lower then 10 and then adding no, one or two zeros before the position number. However the Merge PDF still insists on putting the pages in the same order as before...
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Add fixed length numerical value as Private Data or suffix

Post by Arthur »

So from this string example - P123456_1_flying-elephant-100x70-1.pdf
Which element / block indicates the single digit number, or double digit number or - if applicable (a 3digit) that requires changing ??
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Add fixed length numerical value as Private Data or suffix

Post by LasseThid »

It's the last number that is the suffix.

I'd like the file name to be P123456_1_flying-elephant-100x70-001.pdf

As I'm having problems getting the files merged in the correct order it may be that I have to have the file name with the position number after the ourder number instead, i.e. P123456_001_flying-elephant-100x70.pdf. I just need to figure the Merge PDF out first...
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: Add fixed length numerical value as Private Data or suffix

Post by Arthur »

Ahhh I see.
So in order to get that you'd need the following Regex:
^(.*)(-)(\d{1})(.[^.]+)$

and the substitution would be:

\1\20\3\4

where the 0 between \2 and \3 makes it 2-digit.
If 3 digits needed, then two 0s need to be put in place.

If you had 2 digits there, then the regex would be: ^(.*)(-)(\d{2})(.[^.]+)$
and subsequently you need only one 0 as in the first substitution.

Reference - https://regex101.com/r/ukbbaM/1
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Add fixed length numerical value as Private Data or suffix

Post by LasseThid »

Thanks Arthur.

Since I would need three different Rename job anyways I might as well stay with the ones I set up.

In order to get Merge PDF to place the pdf's in the correct order I decided to change the file names to be only order number followed by position. The file names are irrelevant anyway. Now I'm just waiting to see if Phoenix will do it's job properly... :-)
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Post Reply