Add fixed length numerical value as Private Data or suffix

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

Add fixed length numerical value as Private Data or suffix

Post by LasseThid » Thu Feb 07, 2019 10:00 am

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 2020 Fall Edition, Enfocus PitStop Server 2020, Enfocus PDF Review, HP SmartStream 12 & Kodak Prinergy 8.2 with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.

Arthur
Member
Posts: 104
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 » Thu Feb 07, 2019 11:00 am

Search & Replace -> RegEx ??
Search ^(\d{1})(_)(.*)
replace 0\1\2\3 ??

LasseThid
Advanced member
Posts: 346
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 » Thu Feb 07, 2019 12:23 pm

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 2020 Fall Edition, Enfocus PitStop Server 2020, Enfocus PDF Review, HP SmartStream 12 & Kodak Prinergy 8.2 with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.

Arthur
Member
Posts: 104
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 » Thu Feb 07, 2019 1:21 pm

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: 346
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 » Thu Feb 07, 2019 1:33 pm

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 2020 Fall Edition, Enfocus PitStop Server 2020, Enfocus PDF Review, HP SmartStream 12 & Kodak Prinergy 8.2 with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.

Arthur
Member
Posts: 104
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 » Thu Feb 07, 2019 1:53 pm

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: 346
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 » Thu Feb 07, 2019 4:07 pm

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 2020 Fall Edition, Enfocus PitStop Server 2020, Enfocus PDF Review, HP SmartStream 12 & Kodak Prinergy 8.2 with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.

Post Reply