rkury14 Posted August 7, 2014 Share Posted August 7, 2014 Hello support, I wonder if you can help or if it is even possible to make a rule that can help me. My issue is I have a customer database that drives the majority of my variable job. In the database there are 4 columns with Bullets content in each. In each Bullet column there are sentences that has the words "On Demand" used periodically. My question is how can I apply the superscript "SM" RULE after those words when they are used. I am a Novice at this, so here is a really bad example of the Rule I started: Or it could maybe be one rule for each Bullet would be fine... if (Field("BULLET_1") == "ON DEMAND") else if (Field("BULLET_2") == "ON DEMAND") else if (Field("BULLET_3") == "ON DEMAND") else if (Field("BULLET_4") == "ON DEMAND") { return "SM" else return " "; } Thanks in advance for your help. Rayed Quote Link to comment Share on other sites More sharing options...
rkury14 Posted August 8, 2014 Author Share Posted August 8, 2014 I think I was able to solve this issue after doing some digging in this online community. Here is Rule I was able to use that actually allowed me to apply the TM superscript to the words "ON DEMAND" where it was being used in my bullets. var s = Field("BULLET_1"); FusionPro.Composition.AddVariable s = s.replace(/ON DEMAND/ig, "<span>" + " ON DEMAND" + "<superscript>TM</superscript>"); return s; I made one Rule for each Bullet column used and changed the number of the bullet like this var s = Field("BULLET_2"); FusionPro.Composition.AddVariable s = s.replace(/ON DEMAND/ig, "<span>" + " ON DEMAND" + "<superscript>TM</superscript>"); return s; Just thought it might help others who had that issue. Quote Link to comment Share on other sites More sharing options...
rkury14 Posted August 13, 2014 Author Share Posted August 13, 2014 I have another help request that is a continuation from my bullet superscript request. I was able to come up with a rule to add the SM reg mark at the end of the sentences in the bullets, however, now I have a problem with those specific words "On Demand" being used in the middle of the sentence where I do not want the SM to apply because there is already a R reg mark on it. Example: "• Includes HBO®, HBO ON DEMAND SM® and HBO GO® with over 1,700 of your favorite HBO original shows, movies, sports and more." How can I continue my rule above to apply an "IF Else" Rule to take it from the middle of the sentence? Thanks for your help. Quote Link to comment Share on other sites More sharing options...
step Posted August 13, 2014 Share Posted August 13, 2014 Can you post an example of the data? One example of a scenario where you'd want to add a superscripted trademark and one where you'd want to ignore it? I'm thinking you'd just search the string for "On Demand" being at the end of the string with a regular expression and then add the TM but I'd need to see how the data is coming to you to be certain. Quote Link to comment Share on other sites More sharing options...
rkury14 Posted August 13, 2014 Author Share Posted August 13, 2014 Here is the attempted rule that does not work. The top half is the original, the bottom half is the add on. Thanks, var s = Field =("BULLET_1") FusionPro.Composition.AddVariable { if (s = s.replace(/On DEMAND/ig, "<span>" + " On DEMAND" + "<superscript>SM</superscript>")); return s;} else return ""; } var m = Field =("BULLET_1") FusionPro.Composition.AddVariable { if (m = m.replace(/HBO On DEMAND/ig, "<span>" + "HBO On DEMAND" + "<superscript>""</superscript>")); return m; else return "";} Quote Link to comment Share on other sites More sharing options...
step Posted August 13, 2014 Share Posted August 13, 2014 I saw the rule that you previously posted. I'm more so asking what the data in the "BULLET_1" field looks like. Quote Link to comment Share on other sites More sharing options...
rkury14 Posted August 13, 2014 Author Share Posted August 13, 2014 I gave an example of the data in Bullet 1 in my first question. Here it is again. I will include the other bullets as well. The SM is suppose to look superscript, but it doesn't translate in this forum. So going off this RULE, how can I take out the SM from the "HBO On Demand" in the middle of bullet 1? var s = Field("BULLET_1"); FusionPro.Composition.AddVariable s = s.replace(/ON DEMAND/ig, "<span>" + " ON DEMAND" + "<superscript>TM</superscript>"); return s; • Includes HBO®, HBO ON DEMANDSM® and HBO GO® with over 1,700 of your favorite HBO original shows, movies, sports and more. • Ask about how you can record 6 shows at once and store up to 1,000 with the Record 6 DVR. • Upgrade to Sports and Information Pak for all the latest sports and news action on channels like NFL Network, NBA TV, NHL Network, ESPN News, ESPN U, Bloomberg and Fox Business. Watch live or ON DEMAND SM. • Surf, stream and share on the fastest in-home WiFi. Thanks Quote Link to comment Share on other sites More sharing options...
step Posted August 13, 2014 Share Posted August 13, 2014 Basically, I think your rule should be written so that it only adds the superscripted SM or TM or whatever you're trying to add when "ON DEMAND" is not followed by a "®" rather than on every occurrence of "ON DEMAND" and then trying to go back and remove it. Like this: return Field("BULLET_1").replace(/(ON DEMAND)(?!®)/gi,'$1<superscript>TM</superscript>'); Quote Link to comment Share on other sites More sharing options...
rkury14 Posted August 13, 2014 Author Share Posted August 13, 2014 Step, Awesome, It works. Your the Best! Thanks, Rayed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.