Jump to content

Composing an array


Recommended Posts

Posted

Trying to compose a series of records in the same order as the output file being generated but i keep getting

"Could not write output file </Users/me/Desktop/Support Files/Table Generators/Brochure Tables/PDFs/BN08890-16#NY11 CEL BPS 10K BRO.pdf>."

 

Anyone see the issue here?

 

//OnJobStartRule
t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"];

for (i = 0; i < t.length; i++){
metal = t[i];
}


//NewOutputFileName
if (FusionPro.inValidation)
   Rule("OnJobStart");

asset = Field("Account").replace(/\//gi, "#");

FusionPro.Composition.outputFileName = asset + " " + metal + " " + "BRO" + ".pdf";


//Table Rule
if (FusionPro.inValidation)
   Rule("OnJobStart");

return generateMarkup(Field("School"), metal);

Posted

What are you trying to do here?

//OnJobStartRule
t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"];

for (i = 0; i < t.length; i++){
metal = t[i];
}

This code is called exactly once at the start of the job, and after the iteration, the value of the variable "metal" is set to the last string in the array ("CEL BPS 10K"). So it's trying to write the same output file every time.

 

If you want to reference a different value from the array for each record, you would need do something like this in a per-record rule:

metal = t[FusionPro.Composition.processedRecordNumber - 1];

Posted

I am trying to make it compose one metal file per array value.

Example:

***XX 10K 14K BRO.pdf

***XX 10K 14K 18K BRO.pdf

***XX BPS 10K 14K BRO.pdf

Posted
I am trying to make it compose one metal file per array value.

Example:

***XX 10K 14K BRO.pdf

***XX 10K 14K 18K BRO.pdf

***XX BPS 10K 14K BRO.pdf

Get rid of the OnJobStart rule and do this in OnNewOutputFile:

var asset = Field("Account").replace(/\//gi, "#");
var t = ["10K 14K","10K 14K 18K", "BPS 10K 14K", "CEL 10K 14K", "CEL BPS 10K"];
var metal = t[FusionPro.Composition.currentOutputFileNumber - 1];
FusionPro.Composition.outputFileName = asset + " " + metal + " " + "BRO" + ".pdf";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...