Hello Everyone,

I have a variable field on a business card template that utilizes the following rule to format the variable text. The variable field is for users to enter their Building-Room# information. Regardless of how the information is entered the rule does exactly what it is suppose to do and returns the information as (example: E12-345) where the two groups (building - room#) of information are always separated by an en dash. Any combination of letter and number characters can exist on either side of the en dash. A lot of our user enter the building and room info separated by a period, space, hyphen etc... and this rule has worked out great to exchange those special characters with the en dash.

The problem that we are experiencing is that when a client enters the information in one group of digits (can be a combination of both/either/or letters and numbers) the following text is returned: {Building_RULE} I understand that the reason that this text is being returned is because my rule does not account for the situation when only 1 group of digits is entered (example: E12). I now somehow need to account for this because it appears that we have a lot of users who order business cards and only like to place their building info without the room info or vice versa.

I was hoping that someone could help me revise the following rule so that if the variable text entered falls into the rule's pattern the rule would process as it is. In the instance when information is entered that does not fall into the rule's pattern the rule would simply return the variable information exactly as it was entered. Thanks in advance for any help!

Rule to edit:
-----------------------------------------------------------
var number01 = Trim(Field("BuildingRoom"));

if (number01 == "")
return "";

var pattern01 = /^(\w+)[^\w]+(\d+)$/;
if (number01.match(pattern01))
formattednumber = number01.replace(pattern01, "$1--$2");
//else Print("no match for " + number01);

return ', Building ' + formattednumber;
--
Nicola DosSantos

Ambit Press / Minuteman Press of Cambridge
Five Cambridge Center
Cambridge, MA 02142
Tel: 617.876.3688
Fax: 617.876.3896
www.ambitpress.com

Please send all jobs to [EMAIL PROTECTED]


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