I get the error
"uncaught exception: Error: In Field(), no field named Order Number"
I'm trying to get the first record of the data to output if the input data file ends with ".txt" otherwise to output all the records which will come as an xls file.
The xls file will have the data column header "Order Number"
//Set page usage
FusionPro.Composition.SetBodyPageUsage("1Title", false);
FusionPro.Composition.SetBodyPageUsage("2Title", false);
if(Field("Division")==""){
FusionPro.Composition.SetBodyPageUsage("1Title", true);
}else FusionPro.Composition.SetBodyPageUsage("2Title", true);
//Pull the job number & order number from the input data file name
//Name needs to have the Job Number first e.g. 123456_86912.1.MyDataFile.txt
//FusionPro.Composition.forcePreprocessing = true; set in onJobStart
var jobNumber = GetFileName(PrimaryInputFile()); //Works in Preview, Validation & Composition mode unlike the old version that works in Composition only
var orderNumber = GetFileName(PrimaryInputFile());
var interNumber = GetFileName(PrimaryInputFile()), myTest;
jobNumber = jobNumber.match(/^\d+/);
interNumber = interNumber.match(/\_[\d\.]+/);
if (orderNumber.match(/\.txt/) == ".txt" && FusionPro.Composition.currentOutputFileNumber == 1){
FusionPro.Composition.startRecordNumber = 1;
FusionPro.Composition.endRecordNumber = 1;
FusionPro.Composition.OpenNewOutputFile(jobNumber + interNumber + Field("Name") + "." + FusionPro.Composition.outputFormatExtension);
var myTest = "Fail";
} else {
orderNumber = Field("Order Number");
}
if (myTest != "Fail" && FieldChanged("Name")) {
FusionPro.Composition.startRecordNumber = 1;
FusionPro.Composition.endRecordNumber = FusionPro.Composition.totalRecordCount;
FusionPro.Composition.OpenNewOutputFile(jobNumber + "_" + orderNumber + "." + Field("Name") + "." + FusionPro.Composition.outputFormatExtension);
}
Yeah, I know it's kinda sloppy and I attempt to clean everything up once I get it working....