Jump to content

Setting page usage code question


rpaterick

Recommended Posts

2 page document.

 

I need the code to state: When rbhealth.com is in the data field "purchase site," return pages 1 and 3 only. All other records, return pages 1 and 2 only.

 

Current Code. Just can't figure out how to state when the field isn't rbhealth.com to return others.

 

if (Field(" PurchaseSite") == "????????????")
{
FusionPro.Composition.SetBodyPageUsage("1",true);
FusionPro.Composition.SetBodyPageUsage("2",true) ;
}

if (Field(" PurchaseSite") == "rbhealth.com")
{
FusionPro.Composition.SetBodyPageUsage("1",true) ;
FusionPro.Composition.SetBodyPageUsage("3",true) ;
}

else
return "";

Link to comment
Share on other sites

Just put the logic for the opposite of the "if" condition in the "else" block:

if (Field("PurchaseSite") == "rbhealth.com")
{
   FusionPro.Composition.SetBodyPageUsage("1",true);
   FusionPro.Composition.SetBodyPageUsage("3",true);
}
else
{
   FusionPro.Composition.SetBodyPageUsage("1",true);
   FusionPro.Composition.SetBodyPageUsage("2",true);
}

Of course, since page 1 is always used, you can just set it that way in the Page Usage dialog, and then the rule reduces to this:

if (Field("PurchaseSite") == "rbhealth.com")
   FusionPro.Composition.SetBodyPageUsage("3",true);
else
   FusionPro.Composition.SetBodyPageUsage("2",true);

Or even:

FusionPro.Composition.SetBodyPageUsage("3", Field("PurchaseSite") == "rbhealth.com");
FusionPro.Composition.SetBodyPageUsage("2", Field("PurchaseSite") != "rbhealth.com");

Or, even simpler:

FusionPro.Composition.SetBodyPageUsage((Field("PurchaseSite") == "rbhealth.com") ? "3" : "2", true);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...