tbone56 Posted September 23, 2014 Share Posted September 23, 2014 Is it possible to name the compiled out put files a name from the database it's connected too? I generate hundreds of two-page pdfs and instead of it just saving the name as a counting number, I would like it to use a column from the database it pulls the user info from. Anyway to make that work? Quote Link to comment Share on other sites More sharing options...
David Miller Posted September 23, 2014 Share Posted September 23, 2014 You can try this in the OnNewOutputFile Callback Rule: FusionPro.Composition.outputFileName = Field("[color="DarkRed"]YourFieldName[/color]") + '[color="DarkRed"].pdf[/color]'; Edit the field name and extension (in red) accordingly. Quote Link to comment Share on other sites More sharing options...
tbone56 Posted September 23, 2014 Author Share Posted September 23, 2014 Ok so I believe I entered that correctly, but I haven't edited these settings in a long while so I may have messed it up. I copied and pasted that code into a new rule but I get a syntax error saying that a ")" is missing. I look and there are an equal amount of opening and closing parenthesis. Any thoughts? Quote Link to comment Share on other sites More sharing options...
David Miller Posted September 23, 2014 Share Posted September 23, 2014 I copied and pasted that code into a new rule but I get a syntax error saying that a ")" is missing. I look and there are an equal amount of opening and closing parenthesis. When I copy and paste the above rule into an OnNewOutputFile Callback Rule and validate, the Expressions OK. The job composes correctly too. But you need to check the Output to multiple files box. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 23, 2014 Share Posted September 23, 2014 (edited) The alternative is to call FusionPro.Composition.OpenNewOutputFile in OnRecordStart. You can do this based on any condition you want, such as when a field value changes, to keep all of the records with a common field value in the same output file. This way, you can have a different number of records in each output file. For example: if (FieldChanged("YourFieldName")) FusionPro.Composition.OpenNewOutputFile(Field("YourFieldName") + "." + FusionPro.Composition.outputFormatExtension); Edited September 26, 2014 by Dan Korn Fixed typo in the code example; missing closing parend Quote Link to comment Share on other sites More sharing options...
tbone56 Posted September 23, 2014 Author Share Posted September 23, 2014 I get the same results on both sets of code. Steps that I take: Open Rules box Select New Click "callback" radio button Click the Call type - OnNewOutputFile or OnRecordStart Paste the code Change "YourFieldName" to "Field 1" Click Validate Get error "OnRecordStart, line 2: SyntaxError: missing ) after argument list" I'm clearly missing something very basic, but can't tell. Does that look like the correct steps? Multiple output files IS checked. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 23, 2014 Share Posted September 23, 2014 I get the same results on both sets of code. Steps that I take: Open Rules box Select New Click "callback" radio button Click the Call type - OnNewOutputFile or OnRecordStart Paste the code Change "YourFieldName" to "Field 1" Click Validate Get error "OnRecordStart, line 2: SyntaxError: missing ) after argument list" I'm clearly missing something very basic, but can't tell. Does that look like the correct steps? Can you copy-and-paste the contents of your rule here? Multiple output files IS checked. If you want to use the new "dynamic chunking", where you can have an arbitrary number of records per output file, by calling FusionPro.Composition.OpenNewOutputFile in OnRecordStart, instead of the older "static chunking," where every output file always having the same number of records, then you need to UNcheck that "Output to multiple files box." Quote Link to comment Share on other sites More sharing options...
tbone56 Posted September 26, 2014 Author Share Posted September 26, 2014 I basically just copy and paste your code and replace the field name. my field name is: Name if (FieldChanged("Name")) FusionPro.Composition.OpenNewOutputFile(Field("Name") + "." + FusionPro.Composition.outputFormatExtension; Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 26, 2014 Share Posted September 26, 2014 I basically just copy and paste your code and replace the field name. my field name is: Name if (FieldChanged("Name")) FusionPro.Composition.OpenNewOutputFile(Field("Name") + "." + FusionPro.Composition.outputFormatExtension; Oh, I see, there was a small typo there. Sorry about that. There's supposed to be a closing parend at the end of the second line, before the semicolon. This should work: if (FieldChanged("Name")) FusionPro.Composition.OpenNewOutputFile(Field("Name") + "." + FusionPro.Composition.outputFormatExtension); Quote Link to comment Share on other sites More sharing options...
tbone56 Posted September 26, 2014 Author Share Posted September 26, 2014 Awesome! That works great! Thanks a lot for the help. 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.