Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Formatting Text

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 7th, 2019, 08:50 AM
rrdwitt rrdwitt is offline
Regular Contributor
 
Join Date: May 2016
Location: Missouri
Posts: 53
Default Conditional text

Hi, I searched the forum but cannot find this rule. Nor am I probably not asking the correct question.

I want to add a "$" to a field if the "$" is not there, but to NOT add the "$" if
the "$" is in the data. So "123" would be changed to "$123". But "$456" would stay "$456".

Thanks all!!
Reply With Quote
  #2  
Old March 7th, 2019, 10:19 AM
sschardan sschardan is offline
Regular Contributor
 
Join Date: Oct 2008
Location: St. Louis, MO
Posts: 81
Default Re: Conditional text

This should work for your scenario:


if (Field("Fieldname").indexOf("$") > -1)


{return Field("Fieldname")}


else


{return ("$" + Field("Fieldname"))


Hope this helps
Reply With Quote
  #3  
Old March 7th, 2019, 10:34 AM
sschardan sschardan is offline
Regular Contributor
 
Join Date: Oct 2008
Location: St. Louis, MO
Posts: 81
Default Re: Conditional text

oops, have a parenthesis instead of a bracket, use this:

{return ("$" + Field("Fieldname")}
Reply With Quote
  #4  
Old March 7th, 2019, 10:43 AM
rrdwitt rrdwitt is offline
Regular Contributor
 
Join Date: May 2016
Location: Missouri
Posts: 53
Default Re: Conditional text

Awesome! Thanks! Much appreciated!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:24 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.