Jump to content

Dynamic Chunking based on Rule


bkurzbuch

Recommended Posts

Im try to get separate output files based a a switch rule and keep getting a syntax error.

 

My code:

 

if (RuleChanged("Acronym Rule")

FusionPro.Composition.OpenNewOutputFile(Rule("Acronym Rule") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

and i get a Line 2: Syntax Error: missing ) after condition.

 

What am I doing wrong.

Thanks for the help

Link to comment
Share on other sites

I see the code did not paste in cleaningly.

 

if (RuleChanged("Acronym Rule")

FusionPro.Composition.OpenNewOutputFile(Rule("Acronym Rule") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

Working on Mac 10.9.5 Acrobat Xi

 

Rule is OnRecordStart

Link to comment
Share on other sites

You're missing a closing parenthesis in red:

if (RuleChanged("Acronym Rule")[color="Red"])[/color]

 

Though, unless you've defined "RuleChanged" as a function in your template, you're going to get another warning saying that "RuleChanged" isn't defined. The FP function is "FieldChanged." Without knowing what your "Acronym Rule" is doing, I can't really offer any insight other than that.

Link to comment
Share on other sites

You need another closing parend ) at the end of the first line, to balance out the opening parends:

if (RuleChanged("Acronym Rule"))

That will get rid of your syntax error. Although, this still won't work, as there's no "RuleChanged" function. You either need to use the FieldChanged function, with a field name, or provide more details about what the data and the Switch rule look like so that someone can provide more specific suggestions.

Link to comment
Share on other sites

Ok - My job has 30 different Associations all pulling Assoc. names and logos based off a data field "Keyline". I tried field change and the rule will validate but I get a error on output. I believes it is because of the data format. "Keyline" is written as 1234/5678/91235/1256. I don't think it will allow the forward slash's in the file name. Thats when i tried to switch to a rule name instead, which returns a acronym base off that key line number. So is there a way to get this to work based of the field "Keyline". To split into 30 different pdf's. Thanks for your help.
Link to comment
Share on other sites

Ok changed my On Job start rule to "Field Changed" and it validates fine. Code below.

 

if (FieldChanged("KEYLINE"))

FusionPro.Composition.OpenNewOutputFile(Field("KEYLINE") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

When i go to compose I get the following error message - Which i believe is because the way the data is written. Is there a way around this error.

 

 

Could not write output file <48619/48641/1001/51801.pdf>.

Job aborted with error.

dlpdfdocwritepdf, progress "Doc->PageCount is zero", error: Bad parameter.

 

PDF Library Document Write Error: Bad parameter.

 

pdf_om_WriteDoc, dtl_pdf_WritePdf returned "-2"

Link to comment
Share on other sites

Ok changed my On Job start rule to "Field Changed" and it validates fine. Code below.

 

if (FieldChanged("KEYLINE"))

FusionPro.Composition.OpenNewOutputFile(Field("KEYLINE") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

When i go to compose I get the following error message - Which i believe is because the way the data is written. Is there a way around this error.

 

 

Could not write output file <48619/48641/1001/51801.pdf>.

Job aborted with error.

dlpdfdocwritepdf, progress "Doc->PageCount is zero", error: Bad parameter.

 

PDF Library Document Write Error: Bad parameter.

 

pdf_om_WriteDoc, dtl_pdf_WritePdf returned "-2"

Okay, so a few questions:

 

First, what version of FusionPro?

 

Second, are you composing locally on your Mac, or are you submitting the job to Windows via FP Direct/Producer or some other means?

 

Third, what exactly are you trying to accomplish? Do you really want the output to be in a folder hierarchy such as "48619/48641/1001/51801.pdf"? What do you want the file names to be? Should they be based on the data? Or on the acronym? Or something else?

 

Maybe you want to write the rule like this:

if (FieldChanged("KEYLINE"))
   FusionPro.Composition.OpenNewOutputFile(Rule("Acronym Rule") +
       "." + FusionPro.Composition.outputFormatExtension);

But it's hard to know for sure based on the very minimal information you've provided so far.

Link to comment
Share on other sites

Fusion Pro Ver 9.3

Working off a server and composing to folder on server.

I'm trying to get my output pdf's to be separated into each association based off the data supplied. Ideally the data would all ready be sorted but it is not. I would like it to name based of a field or rule. I tried the above code change .

 

if (FieldChanged("KEYLINE"))

FusionPro.Composition.OpenNewOutputFile(Rule("Acronym Rule") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

And returns the following error weather i compose to my desktop or server.

 

 

iCould not write output file <SJMS/CMA.pdf>.

Job aborted with error.

dlpdfdocwritepdf, progress "Doc->PageCount is zero", error: Bad parameter.

 

PDF Library Document Write Error: Bad parameter.

 

pdf_om_WriteDoc, dtl_pdf_WritePdf returned "-2"

 

 

 

Thank you soooo much for the help. Under the gun to get the customer samples of each Assocation.

Link to comment
Share on other sites

Fusion Pro Ver 9.3

Working off a server and composing to folder on server.

So, you're sending the job to be composed on a Windows machine running FP Server 9.3?

I'm trying to get my output pdf's to be separated into each association based off the data supplied. Ideally the data would all ready be sorted but it is not. I would like it to name based of a field or rule.

Yes, okay, I get that you want to base the file name on the data, but specifically what file name do you want to end up with? I still don't know exactly what I'm trying to help you accomplish. Can you give an example of the data and the desired output file name that corresponds to it?

I tried the above code change .

 

if (FieldChanged("KEYLINE"))

FusionPro.Composition.OpenNewOutputFile(Rule("Acronym Rule") +

"." + FusionPro.Composition.outputFormatExtension);

 

 

And returns the following error weather i compose to my desktop or server.

 

 

iCould not write output file <SJMS/CMA.pdf>.

Okay, so again, what do you want the file name to be in this case? What do you want to do with those slashes? Do you want folders to be created? Do you want to just remove the slashes to make up the file name? Do you want to just change the slashes to some other character, like dashes, to end up with a file name such as "SJMS-CMA.pdf"? If so, you could do something like this:

if (FieldChanged("KEYLINE"))
{
   FusionPro.Composition.OpenNewOutputFile(
       ReplaceSubstring(Rule("Acronym Rule"), "/", "-") +
       "." + FusionPro.Composition.outputFormatExtension);
}

Or, to be safe:

if (FieldChanged("KEYLINE"))
{
   FusionPro.Composition.OpenNewOutputFile(
       FusionPro.Composition.MakeValidFileName(ReplaceSubstring(Rule("Acronym Rule"), "/", "-")) +
       "." + FusionPro.Composition.outputFormatExtension);
}

But I'm still not sure that's what you want.

Link to comment
Share on other sites

Sorry for the confusion Dan

 

this code did Exactly what i needed.

 

if (FieldChanged("KEYLINE"))

{

FusionPro.Composition.OpenNewOutputFile(

ReplaceSubstring(Rule("Acronym Rule"), "/", "-") +

"." + FusionPro.Composition.outputFormatExtension);

}

 

 

Thank You SOOO much.

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