I have a need to create a string field, with a formatted number, sometimes with 2 decimal places, sometimes 0
It would look like
IF BO.X = 1000 then BO.A = FORMAT(BO.B, '#,##0.00') ELSE BO.A = FORMAT(BO.B, '#,##0')
Can I accomplish this in Aware?
Thanks
Bruce
Is there a FORMAT Function?
Re: Is there a FORMAT Function?
You'll need to explore the AS_STRING function.
Tom - V8.8 build 3137 - MySql / PostGres
Re: Is there a FORMAT Function?
Thanks for the response, but I didn't think I can control the formatting with that. All it does is convert it to a string. Yea, I could then use some substring functions, but it seems like a format function could be pretty useful.
Bruce
Bruce
Re: Is there a FORMAT Function?
I haven't tested it but try adding different styles for the number. Add an applicability condition such as <1000 and with it a different format.
Cheers Rod
Cheers Rod
Re: Is there a FORMAT Function?
Thanks for the suggestion, but I did try that, and unfortunatly, it didnt work. I still have the decimal points. (but, I would like to be more general, and able to be used in a process, so I can both format the number and also append other text to it.
Bruce
Bruce
Re: Is there a FORMAT Function?
Never doubt Tom.
Try:
BO.A = AS_STRING(BO.B, '#,##0.00')
or
BO.A = AS_STRING(BO.B, '#,##0')
Try:
BO.A = AS_STRING(BO.B, '#,##0.00')
or
BO.A = AS_STRING(BO.B, '#,##0')
Bob
Re: Is there a FORMAT Function?
I like that...BobK wrote: Never doubt Tom.
![Image](http://www.mustang6g.com/forums/images/smilies/thumbsup.gif)
Re: Is there a FORMAT Function?
You guys crack me up. My wife would likely give you a different answer.
I thought the syntax was what Bob indicated, but I had never used it. I just tested this rule and it works:
If Customer.Nbr>=1000 Then
Customer.Nbr_String=AS_STRING(Customer.Nbr,'#,##0.00')
ELSE Customer.Nbr_String=AS_STRING(Customer.Nbr,'#,##0')
I'll ask Vladimir to add some of this formatting info to the User Guide documentation of AS_STRING.
I thought the syntax was what Bob indicated, but I had never used it. I just tested this rule and it works:
If Customer.Nbr>=1000 Then
Customer.Nbr_String=AS_STRING(Customer.Nbr,'#,##0.00')
ELSE Customer.Nbr_String=AS_STRING(Customer.Nbr,'#,##0')
I'll ask Vladimir to add some of this formatting info to the User Guide documentation of AS_STRING.
Tom - V8.8 build 3137 - MySql / PostGres
not working for me
I must be doing something wrong, since my rule is:
Quotes.priceString=AS_STRING(Quotes.actualPrice,'#,##0') + '/' + Quotes.perString
and when I display the priceString on a query, I will see: 2300.0/M
No commas and 1 decimal place. hummm...
Quotes.priceString=AS_STRING(Quotes.actualPrice,'#,##0') + '/' + Quotes.perString
and when I display the priceString on a query, I will see: 2300.0/M
No commas and 1 decimal place. hummm...