Jump to content

Template Works on FP7.1P1c but not on 8


Recommended Posts

We are in the processes of doing our own testing of FusionPro 8 Server and have been running numerous templates on it to try and "break it". I think I've found one. We use two different servers (a developmental server for our own testing and one live server for our customers). FusionPro 8.0.20 is on our dev server and 7.1P1C is on our live server.

 

I have a template that I've been running since version 6.x on FusionPro Server that allows me to run a "redo" batch of records by extracting them from the main data file and creating a "new temporary data file". There may be a better way of doing this, but my problem is that this template works on 7.1P1C but not on Version 8.0.20.

 

I use the command "FusionPro.Composition.inputFileName = newfilename;" to invoke the composition engine and use the temporary "redo subset" batch file instead of the larger main data file. This way I don't have to pull out all the redo records from within the main data base - FusionPro will do it on it's own. At least it used to.

 

Instead of creating the smaller, temporary "redo" data file, FusionPro 8 simply runs the template using the entire main data file and appears to by-pass the steps that create the smaller file.

redoDataFileName = new ExternalDataFileEx("redoFileName.txt", "\t");
redoDataFile = redoDataFileName.GetFieldValue(1, "omxFileName");

//create the array of redo record numbers
Redo_File = new ExternalDataFileEx(redoDataFile, "\t");
Redo_Recs = new Array();
totalRedos = Redo_File.recordCount;
recCount = 1;

for (var m = 0; m <= totalRedos; m++)
{
   Redo_Recs[m] = Redo_File.GetFieldValue(m, "Seq #");
}

var FieldDelimiter = ",";  // EDIT THIS ("\t" for tab-delimited)
var FieldDelim2 = '","';  // EDIT THIS ("\t" for tab-delimited)

var orginputfilename = FusionPro.Composition.inputFileName;

// For composition, the original name is set,
// and the new name must be specified as an HFS path on Mac.
// EDIT THIS

var partial = orginputfilename.lastIndexOf("\\");
var pathName = orginputfilename.substring(0, partial+1);
var newfilename = pathName + "tempout_comma.txt";

if (FusionPro.inValidation)
{
   // For composition, both names must be specified as POSIX paths on Mac.
   // EDIT THIS
   orginputfilename = pathName + "temp_Instance.txt";
   // EDIT THIS
   newfilename = pathName + "temp_data_file.txt";
}

var sf = new ExternalDataFileEx(orginputfilename, FieldDelimiter);
if (!sf.valid)
   throw("Unable to open ExternalDataFile: " + orginputfilename);
var of = new File(newfilename);

if (of.open("create") == false)
   throw("Could not create output file.");
of.close();

if (of.open("write") == false)
   throw("Could not write output file.");
of.write('"');

for (var i=0;i<sf.fieldCount;i++)
{
   if (i)
       of.write(FieldDelim2);
   of.write(sf.GetFieldValue(0, i));
}
of.write('"\r\n');

for (var i=1 ; i<=totalRedos ; i++)
{
   of.write('"');
   for (var k=0 ; k< sf.fieldCount ; k++)
   {
       var foundSeq = sf.FindRecord("SEQNO", Redo_Recs[i]);
       if (foundSeq)  {
           if (k)
               of.write(FieldDelim2);
           of.write(sf.GetFieldValue(foundSeq,k));
       }
   }
//    {
//        if (k)
//            of.write(FieldDelim2);
//        of.write(sf.GetFieldValue(Redo_Recs[i],k));
//    }
   of.write('"\r\n');
}

of.close();
FusionPro.Composition.inputFileName = newfilename;

This coding should look familiar to many of you since I believe it came from PTI's Dan Korn quite a few versions ago.

 

Does FusionPro 8 have a different method to create a temporary file? Or does it not recognize some line of this coding anymore?

 

I would like to upload the template and the data file for this, but it is way too large for this Forum. Is there an address I can send it to? To someone's attention?

 

As an added edit to this here is the output from the two .msg file that are created for the same template

From the dev server:

OnJobStart, line 40: ReferenceError: File is not defined
Job started 16:56:18 - 1344372978.
Creator: FusionPro(TM) VDP Producer (API) 8.0.20
Computer Name: FUSIONPRO
Current working folder: C:\Program Files\PTI\FusionPro
Template File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\OMRC_Redos.dif
Input File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\220810_03_merged.TXT
Job Config File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\OMRC_Redos-output.cfg
Preprocessing started 16:56:18 - 1344372978.
Preprocessing record #1, input record 1
Preprocessing record #2, input record 2
Preprocessing record #3, input record 3
Preprocessing record #4, input record 4


from the "live server"

Job started 16:19:07 - 1344370747.
Creator: FusionPro(TM) Server 7.1P1c
Computer Name: FP_LIVE
Current working folder: C:\Program Files\Printable\FusionPro
Template File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\OMRC_Redos.dif
Input File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\tempout_comma.txt
Job Config File: D:\fusionProJobs\Omax\RetailConnectMailer\redoWorkFiles\OMRC_Redos-output.cfg
Preprocessing started 16:19:07 - 1344370747.
Preprocessing input record #1
Preprocessing input record #2
Preprocessing input record #3
Preprocessing input record #4

.

Edited by DSweet
Link to comment
Share on other sites

We do generally strive for backward compatibility, so that older jobs compose the same way in newer versions of FusionPro. However, this is a rare exception to that rule, as the JavaScript File object was removed from FusionPro 8.0. Therefore, you can no longer write an arbitrary file to disk at composition time. This was a big security hole for web-to-print systems.

 

Most usages of the File object, for record repeating and external data file access, have long been superseded with other functionality. In your case, you should be able to simply set FusionPro.Composition.repeatRecordCount in OnRecordStart to accomplish recomposing of certain records. This will be much more efficient than iterating the whole data file and writing out a new one anyway. You don't have to specify the delimiter and all of that in the rule either; just tell it how many times to repeat each record. You can set it to zero (or set FusionPro.Composition.composeThisRecord to false) to skip the record entirely.

Link to comment
Share on other sites

I'm given a file of 200 to 300 records to "redo" that are spread throughout data files of 50,000 to 100,000 records. You're saying that FusionPro can no longer write out a subset-file and use that for composition and I need to wait for FusionPro to compose the entire file "skipping over" those records that do not match the records in the redo-file?

 

Boy will that add a huge amount of time to the FusionPro Server schedule. It use to take FusionPro about 15 to 20 seconds to do this. Now...???

.

Link to comment
Share on other sites

I'm given a file of 200 to 300 records to "redo" that are spread throughout data files of 50,000 to 100,000 records. You're saying that FusionPro can no longer write out a subset-file and use that for composition and I need to wait for FusionPro to compose the entire file "skipping over" those records that do not match the records in the redo-file?

 

Boy will that add a huge amount of time to the FusionPro Server schedule. It use to take FusionPro about 15 to 20 seconds to do this. Now...???

.

You were already loading the entire file 50,000 to 100,000 record data file into memory with ExternalDataFileEx, iterating over it, and writing out an entirely new file, which then had to be read in again. Why do you assume that a single run through the data file is going to be slower?

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...