Hi Dan,
Thanks for the link I'll take a look at it and I'm sure that it will
help me improve the way in which I post questions to the forum.
When I created my test data file I purposely added several records that
are formatted incorrectly. By this I mean that the building Room number
in my data file is separated by a period, hyphen, forward slash, or
space. I did this so that I could test my rule to see if it would
replace these punctuations with the En Dash as I had hoped for.
Examples of incorrect formatting:
E19.215
56/125
M7 23
When I try and validate I'm not recieving an error message. But the rule
is simply returning to me exactly what is in the data file with the
period, hyphen, forward slash, or space. Normally I would think that my
Rule Syntax is incorrect, but like I said I copied it from a template
that is using the exact same rule and returning the data with an En Dash
separator without any problems. Below is the syntax for the rule:
var formatStyle01 = "$1–$2"; //
var formatStyle02 = "$1–$2"; //
var formatStyle03 = "$1–$2"; //
var formatStyle04 = "$1–$2"; //simple 7 digit phone
var formatStyle05 = "$1–$2"; //simple 7 digit phone
var formatStyle06 = "$1–$2"; //simple 7 digit phone
var formatStyle07 = "$1–$2"; //simple 7 digit phone
var formatStyle08 = "$1–$2"; //simple 7 digit phone
var formatStyle09 = "$1–$2"; //simple 7 digit phone
var formatStyle10 = "$1–$2"; //simple 7 digit phone
var formatStyle11 = "$1–$2"; //
var formatStyle12 = "$1–$2"; //
var formatStyle13 = "$1–$2"; //
var formatStyle14 = "$1–$2"; //
var formatStyle15 = "$1–$2"; //
var formatStyle16 = "$1–$2"; //
var formatStyle17 = "$1–$2"; //
var formatStyle18 = "$1–$2"; //
var formatStyle19 = "$1–$2"; //simple 7 digit phone
var formatStyle20 = "$1–$2"; //simple 7 digit phone
var formatStyle21 = "$1–$2"; //simple 7 digit phone
var formatStyle22 = "$1–$2"; //simple 7 digit phone
var formatStyle23 = "$1–$2"; //simple 7 digit phone
var formatStyle24 = "$1–$2"; //simple 7 digit phone
var thisNumber = Field("BuildingRoomNumber");
//////////////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE
///////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
var formattednumber=formatNumber(Trim(thisNumber));
function formatNumber(number01){
var pattern01 = /^(\w{3})[^\w]*(\d{3})$/; // E12-123
var pattern02 = /^(\w{3})[^\w]*(\d{2})$/; // E12-12
var pattern03 = /^(\w{2})[^\w]*(\d{3})$/; // E1-123
var pattern04 = /^(\w{2})[^\w]*(\d{2})$/; // E1-12
var pattern05 = /^(\d{3})[^\w]*(\d{3})$/; // 123-123
var pattern06 = /^(\d{3})[^\w]*(\d{2})$/; // 123-12
var pattern07 = /^(\d{2})[^\w]*(\d{3})$/; // 12-123
var pattern08 = /^(\d{2})[^\w]*(\d{2})$/; // 12-12
var pattern09 = /^(\d{1})[^\w]*(\d{3})$/; // 1-123
var pattern10 = /^(\d{1})[^\w]*(\d{2})$/; // 1-12
var pattern11 = /^(\w{4})[^\w]*(\d{3})$/; // NE12-123
var pattern12 = /^(\w{4})[^\w]*(\d{2})$/; // NE12-12
var pattern13 = /^(\w{4})[^\w]*(\d{1})$/; // NE12-1
var pattern14 = /^(\w{4})[^\w]*(\d{4})$/; // NE12-1234
var pattern15 = /^(\w{3})[^\w]*(\d{4})$/; // E12-1234
var pattern16 = /^(\w{2})[^\w]*(\d{4})$/; // E1-1234
var pattern17 = /^(\w{3})[^\w]*(\d{1})$/; // E12-1
var pattern18 = /^(\w{2})[^\w]*(\d{1})$/; // E1-1
var pattern19 = /^(\d{3})[^\w]*(\d{4})$/; // 123-1234
var pattern20 = /^(\d{3})[^\w]*(\d{1})$/; // 123-1
var pattern21 = /^(\d{2})[^\w]*(\d{1})$/; // 12-1
var pattern22 = /^(\d{2})[^\w]*(\d{4})$/; // 12-1234
var pattern23 = /^(\d{1})[^\w]*(\d{1})$/; // 1-1
var pattern24 = /^(\d{1})[^\w]*(\d{4})$/; // 1-1234
var patternEndExt = /(.)[x#n](.)/;
var patternStart1 = /^[\D]*[1]/;
if(number01.match(pattern01)){
number01 = number01.replace(pattern01, formatStyle01);
return number01;
} else if(number01.match(pattern02)){
number01 = number01.replace(pattern02, formatStyle02);
return number01;
} else if(number01.match(pattern03)){
if (number01.match(patternStart1)){
number01 = number01.replace(pattern03, formatStyle03);
return number01;
} else {
number01 = number01.replace(pattern06, formatStyle06);
return number01;
}
} else if(number01.match(pattern04)){
number01 = number01.replace(pattern04, formatStyle04);
return number01;
} else if(number01.match(pattern05)){
number01 = number01.replace(pattern05, formatStyle05);
return number01;
} else if(number01.match(pattern06)){
number01 = number01.replace(pattern06, formatStyle06);
return number01;
} else if(number01.match(pattern07)){
number01 = number01.replace(pattern07, formatStyle07);
return number01;
} else if(number01.match(pattern08)){
if(number01.match(patternStart1)){
number01 = number01.replace(pattern10, formatStyle10);
return number01;
} else {
number01 = number01.replace(pattern08, formatStyle08);
return number01;
}
} else if(number01.match(pattern09)){
number01 = number01.replace(pattern09, formatStyle09);
return number01;
} else if(number01.match(pattern10)){
number01 = number01.replace(pattern10, formatStyle10);
return number01;
} else if(number01.match(pattern11)){
number01 = number01.replace(pattern11, formatStyle11);
return number01;
} else if(number01.match(pattern12)){
number01 = number01.replace(pattern12, formatStyle12);
return number01;
} else if(number01.match(pattern13)){
number01 = number01.replace(pattern13, formatStyle13);
return number01;
} else if(number01.match(pattern14)){
number01 = number01.replace(pattern14, formatStyle14);
return number01;
} else if(number01.match(pattern15)){
number01 = number01.replace(pattern15, formatStyle15);
return number01;
} else if(number01.match(pattern16)){
number01 = number01.replace(pattern16, formatStyle16);
return number01;
} else if(number01.match(pattern17)){
number01 = number01.replace(pattern17, formatStyle17);
return number01;
} else if(number01.match(pattern18)){
number01 = number01.replace(pattern18, formatStyle18);
return number01;
} else if(number01.match(pattern19)){
number01 = number01.replace(pattern19, formatStyle19);
return number01;
} else if(number01.match(pattern20)){
number01 = number01.replace(pattern20, formatStyle20);
return number01;
} else if(number01.match(pattern21)){
number01 = number01.replace(pattern21, formatStyle21);
return number01;
} else if(number01.match(pattern22)){
number01 = number01.replace(pattern22, formatStyle22);
return number01;
} else if(number01.match(pattern23)){
number01 = number01.replace(pattern23, formatStyle23);
return number01;
} else if(number01.match(pattern24)){
number01 = number01.replace(pattern24, formatStyle24);
return number01;
} else {
//return "no match any pattern";
return number01;
}
}
if (Field("BuildingRoomNumber") == "")
return "";
else
return ', Building ' +formattednumber;
----------------------------------------------------------------------------------------------------------
THANKS AGAIN !!
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]
Dan Korn wrote:
On Jan 2, 2008, at 2:12 PM, Nicola DosSantos wrote:
No problem. Usually you have to get down to specifics to be able to
diagnose a problem effectively. Sometimes it takes some back-and-forth.
Okay, but what exactly do you mean by this? In what specific way is it
not validating properly? What result are you getting, and how is it
different than what you're expecting? Is it returning something other
than the room number? Is there an error message? I can't help you
without having a bit more to go on. The description of what you're
trying to accomplish is helpful, but I still don't know what the error
is. It might help to post the syntax of your rule as well.
Well, from the description of your rule, I doubt that the fonts are
relevant. But I'd have to see the syntax to be sure.
Lengthy is okay, but what's important is specifics. Here's an article
from Microsoft called "How to ask a question":
http://support.microsoft.com/kb/555375
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
--