On Feb 19, 2008, at 3:30 PM, Steve Blatman wrote:
I need help with a couple of types of rules.

1. I have a keyword in a field, and I need to include either nothing,
or one of several paragraphs of fixed text, depending on the keyword.

You want to use some logic like this:

  var result = "";

  switch (Field("MyField").toLowerCase())
  {
    case "hello":
      result += "Welcome to my rule!";
      break;
    case "goodbye":
      result + "Thanks for visiting!";
      break;
    default:
      result += "Say what?";
      break;
  }

  return result;

2. If a particular field is not empty, I need to include several
lines of text, including both fixed words and the contents of several
fields. If the first field is empty, the whole block is left out.

  if (Field("MyField"))
    result += "Field is not empty"; // etc.
  // else do nothing if field IS empty

3. Again, depending on a keyword in a field, I need to include or not
include a block of text that contains both fixed text and the
contents of several fields.

It's just a matter of concatenating whatever literal text you want to return with calls to the Field function.

  result += "My field value is: " + Field("MyField");
  // etc.

Alternately, you can define Formatted Text Resources, and include field values with the "Insert" button in the Variable Text Editor, just like in a text frame. Then you can bring in the resources based on the logic in a rule, for example:

  if (Field("MyField") == "1")
    return Resource("Offer1");
  //etc.

In short, I need to build a page in a document, and what goes on that
page depends on the contents of a few fields, but each of those
fields needs to trigger the presence or absence of a block of several
lines of text that may include other variables.

This is pretty much what VDP is all about!

I'm not a novice at programming, but I could use a few hints, since
I'm not very good at finding things in the manual when I have a
customer calling about deadlines....

Take a look at the samples and tutorials. The Cell Phone tutorial has some examples that seem similar to what you're trying to do, especially in the "Letter" and "Long Offer" rules.

Dan


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!


Variable text on a curve and soft drop-shadows for variable text


LIMITED TIME upgrade offer of $299 per license for current customers:
http://fusionpro.printable.com/store/upgrade

New licenses available for $599 each at:
http://fusionpro.printable.com/store/

All FusionPro 5.0 customers to receive FusionPro 5.1 with
Adobe Acrobat 8 and InDesign CS3 support when released for FREE.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
--
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