KatJones Posted February 14, 2013 Share Posted February 14, 2013 I am sure this has been asked and discussed in maybe a different way. But I have search the forums and can't find a simple solution. I have 5 data fields with dollar amounts in them. None have commas, or dollar signs. In a perfect world I would just use the Number to Currency wizard for all 5 fields that FusionPro gives however.... Not all the data in those fields are numbers, some is text and they change whereas sometimes the "Other $_______ may be in field named AMT1 position. Example: Amt1= 25 Amt2= 50 Amt3=75 Amt4=100 Amt5=Other $________ Example2: Amt1= Other $________ Amt2=(Blank--will be suppressed) Amt3=(Blank--will be suppressed) Amt4=(Blank--will be suppressed) Amt5=(Blank--will be suppressed) Example3: Amt1= 25 Amt2= 50 Amt3=Other $________ Amt4=(Blank--will be suppressed) Amt5=(Blank--will be suppressed) I need to make it where the rule searches the field for numbers only and convert to currency formatting. And if it has text do not format. Quote Link to comment Share on other sites More sharing options...
step Posted February 14, 2013 Share Posted February 14, 2013 Assuming you're trying to list these in one text field, this might work for you: var amt = []; for (var i=1; i<=5; i++){ (Field("Amt" + i) != "") ? amt.push(Field("Amt" + i)) : ""; } return amt.join("<br>").replace(/(\d+)/g,function(n){return FormatNumber("$###,###,###.00",n);}); 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.