(Note, my examples follow the explaination)
The field names in the quotes for the rule you picked up need to match the
field names you are actually using. So if you are setting up this rule to
work with "phone1", then the field in the return statement needs to be
"phone1".
See my examples below, this is how you would set it up your rules using the
variables your indicate in the Text Editor (note, this addresses your second
question too of how you would reverse that phone/label.) Also, these would
each be separate rules, not one long one. Then in your text editor, you
would insert these actual rules in the appropriate places, as opposed to the
variable name. So in the case of your example, where you have <<MainTitle>>
you would instead insert <<rule_MainTitle>> (I name my rules by appending
'rule_' to them for easier identification).
Okay, with all that out of the way, if you are using FusionPro 4.1x, there
is a new feature in the "Paragraph" options called "Suppress if:" with the
following option: "Containing empty variables". This option allows you to
for-go the action of creating and using rules such as those listed below. In
other words, instead of creating a rule to suppress the 'direct' label for a
direct phone, you could just highlight the line containing your
<<DirectPhone>> direct' variable and static text, and select the "Suppress
if" setting of "Containing empty variables". Then the whole line would
suppress if the <<DirectPhone>> variable is empty
/* Rule for suppressing Main Title
* Title: rule_MainTitle
*/
if (field("MainTitle") == "")
return "";
else
return field("MainTitle");
// End of 'MainTitle' rule
/* Rule for suppressing Department
* Title: rule_Department
*/
if (field("Department") == "")
return "";
else
return field("Department");
// End of 'Department' rule
/* Rule for suppressing direct phone and label
* Title: DirectPhone
*/
if (field("DirectPhone") == "")
return "";
else
return field("DirectPhone")+" direct"); // note that there is a space
before 'direct'
// End of 'DirectPhone' rule
I hope this helps as opposed to confusing you further. :)
Craig D.
________________________________
From: support [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 07, 2007 12:37 PM
To: FusionPro Users Forum
Subject: [fusionpro] How do I Reverse the order of this Javascript code?
Hi,
This is what the business card I'm working on looks like.
<Full Name>
<Main Title> These 2 titles I can
suppress if empty in text editor.
<Department>
<Email>
<Address1>
<City>,<State> <Zip>
<Direct Phone> direct These
4 need a rule to suppress the label if the field is empty.
<Fax> fax
<Main Phone> main
<Mobile Phone> mobile
<Website>
I found this rule in the knowledge base. It seems to address my issue
perfectly. I'm new to this, but when I rewrite it to fit my code, it will
not validate
// This rule produces a string like "Phone: 234-234-2344" from two fields:
the phone label and the phone number.
// If the field containing the phone number does not contain a value, the
rule returns nothing.
// You can then apply the "Suppress if Empty" parameter to the rule (see the
FusionPro User's Guide for more information).
if (Field("phone1") == "")
return "";
else
return Field("PhoneLabel") + Field("PhoneNumber");
How do I reverse the order of this rule to match what I am putting in the
text editor?
Thanks
Joseph I
--
Please note: It is the policy of West Press that all e-mail
sent to and from any @westpress.com address may be recorded
and monitored. Unless it is West Press related business,
please do not send any material of a private, personal,
or confidential nature to this or any @westpress.com
e-mail address.
This message has been scanned for UCE (spam), viruses,
and dangerous content, and is believed to be clean
--
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
--