Admin1676454018 Posted August 19, 2008 Share Posted August 19, 2008 This rule looks for ordinal numbers (1st, 2nd, 3rd etc.) and sets the ending two letters to superscript.Copy and paste everything below this line: ________________________________________________ // set superscript font size and baseline shift in template: // Variable Text Editor --> Paragraph... --> Global Settings... // Superscript (Ratio and Offset). // Set variable field name here. SupVariable=Field("Address1") ///////// SupVariable=SupVariable.replace(/(\d)st/gi, "$+<superscript>st</superscript>"); SupVariable=SupVariable.replace(/(\d)th/gi, "$+<superscript>th</superscript>"); SupVariable=SupVariable.replace(/(\d)nd/gi, "$+<superscript>nd</superscript>"); SupVariable=SupVariable.replace(/(\d)rd/gi, "$+<superscript>rd</superscript>"); return SupVariable; Link to comment Share on other sites More sharing options...
Sean_Harman Posted May 1, 2009 Share Posted May 1, 2009 Hello, I have tried using this code but it is not working for me. I am trying to change the ordinal numbers of a date to superscript. I am getting this result: Tuesday, April 21<superscript>st</superscript>, 2009 I admit I am new to Javascript, using it with FP for the first time. Here i what I entered in the rule window: // set superscript font size and baseline shift in template: // Variable Text Editor --> Paragraph... --> Global Settings... // Superscript (Ratio and Offset). // Set variable field name here. SupVariable=Field("Date") ///////// SupVariable=SupVariable.replace(/(\d)st/gi, "$+<superscript>st</superscript>"); SupVariable=SupVariable.replace(/(\d)th/gi, "$+<superscript>th</superscript>"); SupVariable=SupVariable.replace(/(\d)nd/gi, "$+<superscript>nd</superscript>"); SupVariable=SupVariable.replace(/(\d)rd/gi, "$+<superscript>rd</superscript>"); return SupVariable; My FP and operating system info should be in my signature. Can someone let me know what I am doing wrong? Thank you! Link to comment Share on other sites More sharing options...
Dan Korn Posted May 1, 2009 Share Posted May 1, 2009 I have tried using this code but it is not working for me. I am trying to change the ordinal numbers of a date to superscript. I am getting this result: Tuesday, April 21<superscript>st</superscript>, 2009 In the Rule Editor dialog, check the box that says "Treat returned strings as tagged text". Or, in FusionPro 6.0, you can put this at the start of the rule: FusionPro.RuleReturnsTaggedText = true; Link to comment Share on other sites More sharing options...
Sean_Harman Posted May 4, 2009 Share Posted May 4, 2009 Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.