Jump to content

Naming output files from field in database?


tbone56

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Dan Korn
Fixed typo in the code example; missing closing parend
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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); 

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