DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Format decimal places in Report table

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.

 

Durai26_0-1693552105612.png

 

 

In decimal places, no zero's in the last. We don't want to round the number.

 

 

0 Kudos
Message 1 of 4
(1,293 Views)

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:

AnJalpaka_0-1693561102717.png

 

Regards

AnJalpaka

0 Kudos
Message 2 of 4
(1,265 Views)

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.

Durai26_0-1693563658707.png

 

 

 

0 Kudos
Message 3 of 4
(1,251 Views)

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.

0 Kudos
Message 4 of 4
(1,240 Views)