09-01-2023 02:16 AM
Hi,
I would like to format decimal places in the report table. Currently I use "FormatNumber" command to have constant four decimals for all my values. But numbers after decimals, I dont want to have any zeros in the last.
Eg, 100.0000 ==> 100
please find below the table with sample date, first column is what currently the values I have but second column is the formatted one which I was expected to have.
Please provide any suggestions.
In decimal places, no zero's in the last. We don't want to round the number.
09-01-2023 04:39 AM
Hi Durai26,
There is no ready format specification that shows the number with 4 decimal places and no decimal places for an integer value. However, you can achieve the desired formatting by using an expression:
@@IIF(CFV=trunc(CFV), str(CFV, "d"), str(CFV, "d.dddd"))@@
This expression is to be entered for the format of the numbers in the settings dialog of the table:
Regards
AnJalpaka
09-01-2023 05:21 AM
Thanks Anjalpaka for your response,
My table is a textlist table and used expressions in the cells to bring the values into it.
Format option is not enabled for this type of table.
09-01-2023 06:07 AM
Ok, it is unusual to use a text list that itself uses an expression again. It is always advisable to create channels and to fill them with the true type values. Then it will be easier to display the values in a layout and format them as you like ;-).
So, you are using text which includes already an expression like this?
@@Data.GetChannel("[1]/Speed").Values(5)@@
Then you can add the IIF condition and use STR to format your value. Replace CFV in my first example code with your expression content. In this example you get this line of code:
@@IIF(Data.GetChannel("[1]/Speed").Values(5)=trunc(Data.GetChannel("[1]/Speed").Values(5)), str(Data.GetChannel("[1]/Speed").Values(5)), str(Data.GetChannel("[1]/Speed").Values(5), "d.dddd"))@@
Unfortunately, this is not very elegant and very long. That's why another approach would be recommended to display your data in the table.