Jump to content

Naming output file


mclisa81

Recommended Posts

I have a rule that names my output files that I need some help with so it works correctly. I'm uploading my files for clarity if needed.

 

FusionPro.Composition.outputFileName = "ITEMNAME_" + CurrentRecordNumber() + "_" + "codes_" + Field("Codes") + "_thru_" + Field("codeend") +  "." + FusionPro.Composition.outputFormatExtension;

 

1) The CurrentRecordNumber needs to be changed to number the output files sequentially 1, 2, 3, etc.

2) I want to eliminate the Field "codeend" (which I put in manually each time) and use only the Field "Codes" to pull in the ending code # of each batch.

 

Assuming for this example, I'm composing 23 records in batches of 10. My rule names the output...

 

ITEMNAME_1_codes_X43c_thru_My1x.pdf

ITEMNAME_11_codes_eX92_thru_P9Mt.pdf

ITEMNAME_21_codes_w6MZ_thru_Z7e1.pdf

 

What I'd like the files to be named, using only the Field "Codes" are...

ITEMNAME_1_codes_X43c_thru_My1x.pdf

ITEMNAME_2_codes_eX92_thru_P9Mt.pdf

ITEMNAME_3_codes_w6MZ_thru_Z7e1.pdf

 

Thanks in advance.

Lisa

Output_test_template.pdf

filename.txt

Link to comment
Share on other sites

Would this work for you?

var input = new ExternalDataFileEx(FusionPro.Composition.inputFileName,"\t");
var codeEnd = input.GetFieldValue(FusionPro.Composition.inputRecordNumber+9,"Codes");
var fileName = "ITEMNAME_" + FusionPro.Composition.currentOutputFileNumber + "_codes_" + Field("Codes") + "_thru_" + codeEnd + ".pdf";
FusionPro.Composition.outputFileName = fileName;

Link to comment
Share on other sites

Hi,

 

Thanks for the quick reply!

 

It's almost there. The only thing is that the last .pdf in the composition may not have 10 records, so it leaves the endcode blank on filename as below...

 

ITEMNAME_3_codes_w6MZ_thru_.pdf

 

Any idea for fixing that?

 

I'm going to play around with the rule you sent me and see if I can come up with anything.

 

Thanks for the help

Lisa

Link to comment
Share on other sites

Oh, I see. Probably the easiest thing to do is to modify the 'codeEnd' variable to look like this:

var codeEnd = input.GetFieldValue(FusionPro.Composition.inputRecordNumber+9,"Codes") || input.GetFieldValue(input.recordCount,"Codes");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...