View Full Version : Using More than one OnRecord Start
rgreenidge
May 25th, 2009, 02:53 PM
I have a template that requires more the one "OnRecordStart" Rule, but I am unable to get both of them to function in the same template. Is this possible.
I am using FP 6.0 on a Mac.
Thanks,
Richard.
esmith
May 26th, 2009, 05:37 AM
FusionPro only processes one record at a time so as for the rule, like Highlander, there can be only one. What are you trying to do? I would think you would place both "functions" in the one rule.
rgreenidge
May 26th, 2009, 07:08 AM
For the first function I want to turn off and on Unused Body pages and the second part I want to use the Repeat record count function.
Thanks,
Richard.
esmith
May 26th, 2009, 08:02 AM
You would perform both "actions" in the one rule. I do it all the time. :)
rgreenidge
May 26th, 2009, 09:02 AM
Thanks Eric for the reply, is there a certain command that I have to insert between the two scripts to combine them.
Thanks,
Richard.
Dan Korn
May 26th, 2009, 10:46 AM
You should just be able to copy and paste both sections of the code into the single rule. What happens when you try this? If you could paste the code here, it would be a lot easier to help.
rgreenidge
May 26th, 2009, 10:57 AM
Hi Dan, here are the scripts I am trying to use:
if (Field("PR_LETTER") == "RTF")
{
FusionPro.Composition.SetBodyPageUsage("RT_F", true);
}
else if (Field("PR_LETTER") == "RTE")
{
FusionPro.Composition.SetBodyPageUsage("RT_E", true);
}
else if (Field("PR_LETTER") == "ICE")
{
FusionPro.Composition.SetBodyPageUsage("IC_E", true);
}
else if (Field("PR_LETTER") == "ICF")
{
FusionPro.Composition.SetBodyPageUsage("IC_F", true);
}
else if (Field("PR_LETTER") == "IVF")
{
FusionPro.Composition.SetBodyPageUsage("IV_F", true);
}
else if (Field("PR_LETTER") == "MTF")
{
FusionPro.Composition.SetBodyPageUsage("MT_F", true);
}
else if (Field("PR_LETTER") == "MTE")
{
FusionPro.Composition.SetBodyPageUsage("MT_E", true);
}
esmith
May 26th, 2009, 11:51 AM
Nope. In my data, I have a field for the version and a field for the quantity of that record needed. Assuming I name my PDF pages the same as the information in the associated field, my OnRecordStart rule looks something like this:
//assign which page to use per record
FusionPro.Composition.SetBodyPageUsage(Field("PR_LETTER"),true);
//assign how many copies of each record to output
FusionPro.Composition.RepeatRecordCount(Field("Quantity"));
If I have a front and back for each version, I create variables that are built from the field name and then place them in the SetBodyPageUsage argument like so:
//make sure these results match page names assigned in "Manage Pages..."
var Front = Field("PR_LETTER") + "-front";
var Back = Field("PR_LETTER") + "-back";
//assign which pages to use per record
FusionPro.Composition.SetBodyPageUsage(Front,true) ;
FusionPro.Composition.SetBodyPageUsage(Back,true);
//assign how many copies of each record to output
FusionPro.Composition.RepeatRecordCount(Field("Quantity"));
In your case, you would need to remove the underscore from the page name so that the page name matches the name in the field of the associated record. HTH.
Dan Korn
May 26th, 2009, 12:45 PM
Hi Dan, here are the scripts I am trying to use:
if (Field("PR_LETTER") == "RTF")
{
FusionPro.Composition.SetBodyPageUsage("RT_F", true);
}
<snip>
Okay, so that's one. What's the other? What happens if you just put that other logic after this?
rgreenidge
May 28th, 2009, 09:45 AM
Hi Gentlemen, I am now getting a chance to try what Eric has suggested. When I got to validate it gives me an error that Fusion Pro has no properties.
Thanks,
Richard.
Dan Korn
May 28th, 2009, 11:45 AM
Hi Gentlemen, I am now getting a chance to try what Eric has suggested. When I got to validate it gives me an error that Fusion Pro has no properties.
Can you please copy-and-paste the exact contents of the rule, and of the error message? There's a typo in Eric's post ("FusionPro.Compostion.RepeatRecordCount" should be ("FusionPro.Composition.RepeatRecordCount"), so I suspect that might be the cause of the error.
rgreenidge
May 29th, 2009, 06:50 AM
Hi Dan, here is what I have:
//assign which page to use per record
FusionPro.Composition.SetBodyPageUsage(Field("PR_LETTER"),true);
//assign how many copies of each record to output
FusionPro.Compostion.RepeatRecordCount(Field("PR_QTY"));
esmith
May 29th, 2009, 07:09 AM
Hi Dan, here is what I have:
//assign which page to use per record
FusionPro.Composition.SetBodyPageUsage(Field("PR_LETTER"),true);
//assign how many copies of each record to output
FusionPro.Compostion.RepeatRecordCount(Field("PR_QTY"));
Dan is correct -- I didn't win the spelling bee. Change "Compostion" to "Composition" in the quantity code.
rgreenidge
May 29th, 2009, 08:06 AM
Gentleman, this is working now. Thanks for all the help.
Richard.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.