Jump to content

Multiple output files based on the first character of a field


Recommended Posts

Posted

I'm trying to create separate output files based on a field value. Actually...Part of a field value. They only way I've been able to get this to work is by creating an additional field in the datafile.

 

 

I am trying to use the first character in the Field "endorse" so I created this variable.

 

var tray =(Field("endorse").charAt(0));

 

 

 

Here is where it obviously doesn't work because "tray" is a var not a Field.

if (FieldChanged("tray"))

{

FusionPro.Composition.OpenNewOutputFile(("Trays-") + tray) + ".pdf"

};

 

 

 

 

 

Created a new Field called "Trays" and sure enough I get exactly what I want...several different output files ready to print. Problem is...I need to be able to do this Without creating the new Field "Trays" in the datafile.

 

 

 

 

This one works fine but I needed to make a new Field in the datafile to get it to work.

 

var tray =(Field("endorse").charAt(0));

 

if (FieldChanged("Trays"))

{

FusionPro.Composition.OpenNewOutputFile(("Trays-") + tray) + ".pdf"

};

 

 

Any help would be much appreciated!!! Thanks

 

 

FYI I'm using FP 11.2.1 with Acrobat DC 2020.013 on Mac OS 10.7.2 Catalina.

Posted

In JavaScript Globals:

var oldTray = "";

In OnRecordStart:

var tray = Field("endorse")[0];
if (oldTray != tray)
{
   FusionPro.Composition.OpenNewOutputFile(("Trays-") + tray) + ".pdf"
}
oldTray = tray;

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