Jump to content

Adding commas and dollar signs


Recommended Posts

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.



Amt1= 25

Amt2= 50



Amt5=Other $________



Amt1= Other $________

Amt2=(Blank--will be suppressed)

Amt3=(Blank--will be suppressed)

Amt4=(Blank--will be suppressed)

Amt5=(Blank--will be suppressed)



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.

Link to comment
Share on other sites

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);});

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...