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?
Thanks!
Ryan
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.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
- RyanHulslander Offline
- Posts: 1
- Joined: Mon Dec 14, 2015 12:27 pm
- Support_Rick Offline
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
- Contact:
Re: FormatNumber as currency - but need a decimal
Ryan,
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, '$####.##')}" version="2.0" />
The output log will show this:
Variable 'FormattedNumber' was created and set to '$530.84'.
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, '$####.##')}" 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
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696