Eric,

Try it in a Text-Rule this way...


var cszOut = "";

if (Field("txtCity") != "")  {
        cszOut += Field("txtCity")+", ";
}

if (Field("txtState") != "")  {
        cszOut += Field("txtState")+" ";
}

if (Field("txtZip") != "")  {
        cszOut += Field("txtZip");
}

return cszOut;



You will be starting out with a blank variable every time you go into the rule, 
and adding to that variable "cszOut" ONLY if something is contained in the 
individual data fields. If nothing exists in all of them, then the original 
blank value is return from the rule.

---
David A. Sweet
Web Designer/Graphic Designer
HKM Direct Market Communications
A DirectConnectGroup Company

-----Original Message-----
From: Eric Carbone [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 03, 2008 4:07 PM
To: FusionPro Users Forum
Subject: [fusionpro] City State Zip rule

Building City, State and Zip Code on one line is something I do all the time. 
The problem is, it takes three rules to do this (below). I was wondering if 
someone could help me consolidate them all into one rule (using functions?):


RULE 1:
**********************************************************************
// CityRule
// Include comma and space after the City ONLY if txtCity is not empty

if (Field("txtCity") == "")
        return "";
else
        return Field("txtCity")+", ";


RULE 2:
**********************************************************************
// StateRule
// Include space after the State ONLY if txtState is not empty

if (Field("txtState") == "")
        return "";
else
        return Field("txtState")+" ";


RULE 3 (Combines rules 1 and 2, and adds the Zip Code field)
**********************************************************************
// CityStateZipRule
// Returns City comma State space ZipCode
// Requires the two rules above

var CityStateZip = new Array();
if(Rule("CityRule") > "") CityStateZip[CityStateZip.length] = Rule("CityRule");
if(Rule("StateRule") > "") CityStateZip[CityStateZip.length] = 
Rule("StateRule");
if(Field("txtZip") > "") CityStateZip[CityStateZip.length] = Field("txtZip");
return CityStateZip.join("");




-- 
Eric Carbone
Systems Administrator
MOR Printing, Inc
  

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.5/1357 - Release Date: 4/3/2008 10:48 
AM
 

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