hi!... new to navision here... in C/AL code, how will i format a number with data type of decimal into a string?... the output should be a string and should always have 2 decimal places...
for example: the output of 5 should be 5.00 (in string)
thanks in advance for your help!
Comments
1) Do you want the 'decimal point' to follow the convention for the user's locale (e.g. someplaces use 'dot', others use 'comma'), or do you always need a 'dot'? 2) Do you want the thousands to be grouped (e.g. 1,234.56), and if so, should the 'grouping symbol' follow the convention for the user's locale, or do you require a specific character?
So, you need to experiment a little. Start with: If this doesn't give you the right number of decimal places, try If you do not want thousands grouping, use one of the following: Finally (or perhaps better 'first') see the on-line help 'C/SIDE Reference Guide' topic on the Format property and the FORMAT statement.And I get these results:
- 484
- 199.5
- 422
- 1034.50
- 1246.00
etc.As you can see, some numbers are converted to two decimals even when the original number is an integer value. What am I doing wrong?
i have tested your code and at me it works.
how did you test?
br
Josef Metz
Josef Metz
The string output is written to ascii. The thing is that my output is being written to a csv-file which then is read by Excel. I used an hex-editor to doublecheck the contents of the csv-file, and in that file the output is correct. So the Navision-functionality is alright.
Danke!