Topic Options
#41837 - 01/07/13 12:41 AM How to create a PDF file name by data selection
Andy1974 Offline
OL Guru

Registered: 03/26/08
Posts: 110
Loc: Hong Kong
Dear all,

I want to create a PDF file name by data selection as below.

Structure of pdf file name :
----------------------------
(Row 6, column 66 to 75)_(Row 8, column 66 to 75)_(Row 33, column 20 to 35).pdf

Example 1 of data :
(Row 6, column 66 to 75) = SA00023202
(Row 8, column 66 to 75) = REVISE1229
(Row 33, column 20 to 35) = Y20000

Result will be : SA00023202_REVISE1229_Y20000.pdf

Example 2 of data :
(Row 6, column 66 to 75) = SA00023202
(Row 8, column 66 to 75) = blank
(Row 33, column 20 to 35) = blank

Result will be : SA00023202__.pdf

However, data in (row 8, column 66 to 75) and (row 33, column 20 to 35) will be blank in sometimes.

I want to write a script to check if they are blank,
file name will exclude underscore, just like this e.g. SA00023202.pdf

Can anyone have any idea on it ?

Many thanks !
Best Regards,
Andy...

Top
#41842 - 01/07/13 10:18 AM Re: How to create a PDF file name by data selection [Re: Andy1974]
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4953
Loc: Objectif Lune Montreal
Andy,

You do not necessarely need a script. First, after your Create PDF action, put a Set Job Info and Variables, and assign the three values to three local variables that you will create. (Let's call them Var1, Var2 and Var3 for this example)

After that, you will create a branch. In the branch, you will make a Text Conditon that will check if Var2 is equal to an empty string(leave the "Compare to String" field blank). If it's empty, you will simply end the True branch by putting a "Delete" action. If it's NOT equal to an empty string, you will use a Set Job Info and Variables action, and will set Var2 to:

_%{Var2}

Thus adding an underscore. After that, duplicate the branch, and do the same thing for Var3. (you do not need to do it for the first one)

Finally, once you're done with the two branches, in the Send to Folder action, for the name of the file, it will be:

%{Var1}%{Var2}%{Var3}.pdf

This way, underscores will be in the variables themselves, and will not be static. If the regions are empty, the variables will simply be empty, and nothing will appear in the file name at that position.

Hope that helps!

Regards,
Raphaƫl Lalonde Lefebvre

Top
#41865 - 01/08/13 02:56 AM Re: How to create a PDF file name by data selection [Re: Raphael Lalonde Lefebvre]
Andy1974 Offline
OL Guru

Registered: 03/26/08
Posts: 110
Loc: Hong Kong
Dear Sir,

Many thanks your quick reply !
I've tried it, it's worked great.

Thank you very much !

Best Regards,
Andy...

Top