#11
|
|||
|
|||
![]()
Dan,
I created a new rule in Fusion Pro and pasted in your code Code:
var result = ToTitleCase(Field("Full Name");); var Exceptions = [ "I", "II", "III", "IV" ]; for (var i in Exceptions) { var re = RegExp("\\b" + Exceptions[i] + "\\b", "gi"); result = result.replace(re, Exceptions[i]); } return result; line 1:Syntax Error: missing ) after argument list. Can you help me? |
#12
|
||||
|
||||
![]()
There's an extra semicolon in the first line.
It should read: var result = ToTitleCase(Field("Full Name")); |
#13
|
||||
|
||||
![]() Quote:
Code:
var result = ToTitleCase(Field("Full Name")); var Exceptions = [ "I", "II", "III", "IV" ]; for (var i in Exceptions) { var re = RegExp("\\b" + Exceptions[i] + "\\b", "gi"); result = result.replace(re, Exceptions[i]); } return result;
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
#14
|
||||
|
||||
![]()
Sorry to resurrect the thread -
I'm having a bit of an issue here, using the typical ProperCase rule: Quote:
My client only has the two companies that this is affected by, so it's really not a matter of listing out every possible permutation. We'll be notified if any new ones arise, so it'll just be a matter of plugging them in. Long story short, I'd like the ProperCase to continue, just not when the letters ABC are involved....
__________________
-Windows 7 Professional - Adobe CS5.5 -Acrobat Professional X -FusionPro Designer 8.2.5 |
#15
|
||||
|
||||
![]()
Using an array the way Dan suggested is the easiest to manage when there are a lot of variables or when you know you'll be adding more in the future.
If you have a few static values you are dealing with or if you don't want to deal with arrays and loops you can use a simple if/else rule: Code:
var Var1 = Field("AgencyName").toLowerCase(); if (Var1 == "abc corporation") return "ABC Corporation"; else if (Var1 == "pti") return "PTI"; else return ToTitleCase(Var1); |
#16
|
||||
|
||||
![]()
That didn't seem to want to work....
![]() I'm still getting the first letter Upper Case and the 2nd Lower. It should say "MW" both upper....
__________________
-Windows 7 Professional - Adobe CS5.5 -Acrobat Professional X -FusionPro Designer 8.2.5 |
#17
|
||||
|
||||
![]()
As stated, it has to be an exact match to the entire string, the only exception being that it's all going to be in lowercase to get around any inconsistencies with case.
Code:
if (Var1 == "mw financial") return "MW Financial"; The misspelled "mw finacail" would not work. You would have to put in another else if to handle misspellings. This is where Dan's suggestion of using an array and loop would be preferable as you could add in lots of variants easily. Alternatively you could do something like this: Code:
if (Var1.substring(0,3) == "abc") return "ABC Corporation"; else if (Var1.substring(0,2) == "mw") return "MW Financial"; |
#18
|
||||
|
||||
![]()
That'll do! Thanks!
__________________
-Windows 7 Professional - Adobe CS5.5 -Acrobat Professional X -FusionPro Designer 8.2.5 |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|