Jump to content

JavaScript rule using Record Count


kleland

Recommended Posts

Hi, any assistance would be appreciated. I'm trying to write a rule for a variable web postcard using OnRecordStart that will generate a page with indicia OR one with no indicia based on the record count of the variable file being uploaded. I have created and named my 2 pages using Manage Pages and written my rule. My result is always the same with the rule as written – it gives me the page with an indicia regardless of the record count. If anyone can show me how to write this rule, it would be appreciated. Thanks!

 

I'm using MAC OS 10.4.10, Acrobat 7, FP Desktop Version 4.2P1d

 

 

RULE as it stands now:

 

 

 

(ExternalDataFileEx.recordCount == '')

FusionPro.Composition.composeThisRecord = false;

 

if (ExternalDataFileEx.recordCount <= 199)

 

{

FusionPro.Composition.SetBodyPageUsage('Back_NI', true);

FusionPro.Composition.SetBodyPageUsage('Back_Indicia', false);

}

 

else

 

{

FusionPro.Composition.SetBodyPageUsage('Back_NI', false);

FusionPro.Composition.SetBodyPageUsage('Back_Indicia', true);

}

Link to comment
Share on other sites

Hi, any assistance would be appreciated. I'm trying to write a rule for a variable web postcard using OnRecordStart that will generate a page with indicia OR one with no indicia based on the record count of the variable file being uploaded. I have created and named my 2 pages using Manage Pages and written my rule. My result is always the same with the rule as written – it gives me the page with an indicia regardless of the record count. If anyone can show me how to write this rule, it would be appreciated. Thanks!

 

I'm using MAC OS 10.4.10, Acrobat 7, FP Desktop Version 4.2P1d

 

 

RULE as it stands now:

 

 

 

(ExternalDataFileEx.recordCount == '')

FusionPro.Composition.composeThisRecord = false;

 

if (ExternalDataFileEx.recordCount <= 199)

 

{

FusionPro.Composition.SetBodyPageUsage('Back_NI', true);

FusionPro.Composition.SetBodyPageUsage('Back_Indicia', false);

}

 

else

 

{

FusionPro.Composition.SetBodyPageUsage('Back_NI', false);

FusionPro.Composition.SetBodyPageUsage('Back_Indicia', true);

}

 

I find you just about have to set all pages to UNused in the page manager and turn ON only the pages you need via rule..

 

So, your:

\\[b]FusionPro.Composition.SetBodyPageUsage('Back_Indicia', false);[/b]

Also, the rules loop UNTIL a condition is found to be true and THEN stops processing..

 

HTH..

Link to comment
Share on other sites

Thanks, but I'm not sure I understand. My body pages are currently UNused and the condition I'm trying to write is that if the record count in less than or equal to 199, use No Indicia page, else use Indicia page.
Link to comment
Share on other sites

Your page usage rule looks correct, but unless there's more to your code at the beginning, the problem is how you're getting the recordcount.

 

Look at the ExternalDataFileEx object in the Rules Guide (page 84 in my version) for more details.

 

Try something like this:

 

 
YourDataFile = new ExternalDataFileEx([color=red]'C:\\Printable\\data.csv'[/color], '[color=red],[/color]');
if (YourDataFile.recordCount <=199)
{ FusionPro.Composition.SetBodyPageUsage('Back_NI', true); }
else
{ FusionPro.Composition.SetBodyPageUsage('Back_Indicia', true); }

 

You'll have to update the path to your data file and delimiter (in red), and this works with both pages set to unused, only turning on the one that's needed depending on the count.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...