Well, you could change the order in which you're returning things from your 
rule so that the tags in the other rule modify the literal strings, like so:

  return Rule("Address1FONTRULE") + "1234567890 main street" +
      '<p>' + "anywhereville, ca 92075";

But, I don't think that will do what you're trying to accomplish.  You want the 
numbers and letters in "1234567890 main street" to be in different fonts, 
right?  Simply calling the one rule and appending more text to that result 
won't do it.

It seems that what you're trying to do here is to have one rule pass input 
parameters to another rule.  Unfortunately, you can't do that, since rules 
don't take parameters.  You could set some global variables in the first 
(caller) rule and have the second (callee) rule access them.  But, what you 
really want to do in a case like this is to make a function.

Fortunately, turning a rule into a function is very easy.  All you have to do 
is cut-and-paste the body of the rule into a function block, like so:

  function MyFunctionName()
  {
    // copy the rule's code here
  }

Then add the parameters between the parentheses after the function name.  The 
function can be defined either in your JavaScript Globals or in the rule which 
is calling it.

In your case, it looks like you want to use the Address1FONTRULE as a function. 
 It seems that you have one parameter called string1.  So, the function would 
look something like this:

  function AddressFonts(string1, changedChars_font, annon_changedChars_font)
  {
    var changedChars_font = "MetaPlusBook";
    var non_changedChars_font = "MetaPlusBookCaps";

    //new_string1 will contain the return value
    new_string1 = "";

    // COPY ALL THE REST OF THE RULE AFTER THE LINE ABOVE HERE
  }

You can give the function whatever name you want.  Once you have the function, 
you can call it with the parameters you want.  For instance:

  return AddressFonts("1234567890 main street" + '<p>' + "anywhereville, ca 
92075");

Or simply:

  return AddressFonts(Field("Address1"));

You could also make changedChars_font and non_changedChars_font parameters of 
the function if you want.  You can even make them optional by providing 
defaults, like so (sorry for the wrapping in the email):

  function AddressFonts(string1, changedChars_font_in, 
annon_changedChars_font_in)
  {
    var changedChars_font = changedChars_font_in || "MetaPlusBook";
    var non_changedChars_font = annon_changedChars_font_in || 
"MetaPlusBookCaps";

    //new_string1 will contain the return value
    new_string1 = "";

    // COPY ALL THE REST OF THE RULE AFTER THE LINE ABOVE HERE
  }

By the way, a much shorter version of the function would be:

  function AddressFonts(string1, changedChars_font_in, 
annon_changedChars_font_in)
  {
    var changedChars_font = changedChars_font_in || "MetaPlusBook";
    var non_changedChars_font = annon_changedChars_font_in || 
"MetaPlusBookCaps";

    return "<f name=\"" + non_changedChars_font + "\">" + 
        s.replace(/\d+/g, "<f name=\"" + changedChars_font + "\">$&</f>") +
        "</f>";
  }

Regular expressions rock!

Dan

P.S.  Please sign your name at the bottom of your posts so that others know how 
to address you.


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