TroyM68 Posted December 14, 2020 Share Posted December 14, 2020 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. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted December 14, 2020 Share Posted December 14, 2020 In JavaScript Globals: var oldTray = ""; In OnRecordStart: var tray = Field("endorse")[0]; if (oldTray != tray) { FusionPro.Composition.OpenNewOutputFile(("Trays-") + tray) + ".pdf" } oldTray = tray; Quote Link to comment Share on other sites More sharing options...
TroyM68 Posted December 14, 2020 Author Share Posted December 14, 2020 Dan, Worked perfectly, as always.....Thank you!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.