FormatNumber as currency - but need a decimal

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
2 posts Page 1 of 1


Posts: 1
Joined: Mon Dec 14, 2015 12:27 pm

Post by RyanHulslander » Tue Dec 29, 2015 12:56 pm
Question - is there an easy way to use "FormatNumber" and take a fixed length field such as 00053084 and convert it to $530.84 ?

What I'm trying to do is take a number that is in a fixed-length record and display it with the decimal before the rightmost two digits. Everything I see in the FormatNumber pattern shows me how to add in a ".00" if it's not there, or perform rounding if the number already contains a decimal. In this case there is no decimal but the #.## pattern is implied with the rightmost two digits.

Is there a way to invoke FormatNumber on this or do I need to come up with a slightly more elaborate function to take the number convert it to a string and chop it up for display accordingly?




Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Dec 29, 2015 1:19 pm

The easiest way to do this is to just format the number as needed using the "/100" method. Since the value is implied as 2 decimals, this can be done like this:

Using MyNumber = 00053084

<setVariable label="setVar: FormattedNumber" name="FormattedNumber" value="${FormatNumber(MyNumber/100, &apos;$####.##&apos;)}" version="2.0" />

The output log will show this:

Variable 'FormattedNumber' was created and set to '$530.84'.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1