I'm not sure why there's this common misperception that you have to have
these really long rules that specify every page in every case.  If you
mark all the pages, except for the one that's always included, as unused
initially, as Lauren suggests, then you don't need to set their usages
to false again each time.  All you have to do is turn on the one you
want for each record.  So the rule gets much simpler:

  if (Field("SALUTATION") == "ENG.EPS")
    FusionPro.Composition.SetBodyPageUsage("English_Front",true); 
  else if (Field("SALUTATION") == "RUS.EPS")
    FusionPro.Composition.SetBodyPageUsage("Russian_Front",true); 
  else if (Field("SALUTATION") == "POL.EPS")
    FusionPro.Composition.SetBodyPageUsage("Polish_Front",true);
  else if (Field("SALUTATION") == "POR.EPS")
    FusionPro.Composition.SetBodyPageUsage("Portuguese_Front",true);
  else if (Field("SALUTATION") == "SPA.EPS")
    FusionPro.Composition.SetBodyPageUsage("Spanish_Front",true);
  else if (Field("SALUTATION") == "VIE.EPS")
    FusionPro.Composition.SetBodyPageUsage("Vietnamese_Front",true);
  else 
    Print("Could not find a body page to match Salutation: " +
          Field("SALUTATION"));

I'm not sure why there's this common misperception that you always have
to have these really long rules that specify every page every time.

Of course, all these "else if"s can be simplified with a switch
statement: 

  var PageName = "";
  switch (ToUpper(Field("SALUTATION")))
  {
    case "ENG.EPS":
      PageName = "English_Front"; break;
    case "RUS.EPS":
      PageName = "Russian_Front"; break;
    case "POL.EPS":
      PageName = "Polish_Front"; break;
    case "POR.EPS":
      PageName = "Portuguese_Front"; break;
    case "SPA.EPS":
      PageName = "Spanish_Front"; break;
    case "VIE.EPS":
      PageName = "Vietnamese_Front"; break;
  }

  if (PageName)
    FusionPro.Composition.SetBodyPageUsage(PageName, true); 
  else
    Print("Could not find a body page to match Salutation: " +
          Field("SALUTATION"));

  return PageName; // for validation

Or, even more succinctly, you could create a simple mapping:

  var SalToPageMap =
  {
    "ENG.EPS" : "English_Front",
    "RUS.EPS" : "Russian_Front",
    "POL.EPS" : "Polish_Front",
    "POR.EPS" : "Portuguese_Front",
    "SPA.EPS" : "Spanish_Front",
    "VIE.EPS" : "Vietnamese_Front",
  };

  var PageName = SalToPageMap[ToUpper(Field("SALUTATION"))];

  if (PageName)
    FusionPro.Composition.SetBodyPageUsage(PageName, true); 
  else
    Print("Could not find a body page to match Salutation: " +
          Field("SALUTATION"));

  return PageName; // for validation

You can see how this is easily extensible to add more language types.

Dan


--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to