Add Data Row Data format changing

Hello guys i have created a table using build data table in which below column is double
image

Here the below marked value are decimal values while adding it the add data row and write into excel it is not giving the decimal point only the rounded figure.

  1. I have used message box for that variable it is giving values with decimal.
    2.I have used output data table and printed it, same it is giving the rounded value.

So is there any solution for this

@Gokul_Murali,

In Add Data Row activity can you try passing the decimal value like this

Math.Round(Convert.ToDecimal(yourDecimalVariable), 2)

incase this works, you can change the last 2 number to your desired decimal points you want in your value.

Thanks,
Ashok :slight_smile:

Hi @Gokul_Murali

Refer the following thread,

Regards,
Gowtham K

Hi @Gokul_Murali ,

You can use math.round to achieve the required format.

Math.round(“yourVariable”,2)

Thanks,
Anjani

@ashokkarale

Still iam getting the same rounded value

@Gokul_Murali,

Change the format of the column before you write the range to the file.
Use Format Cells activity to change the format.

When i printed only the variable it has decimal value like above

So when added that to that datatable and printed using Output data Table the value is rounded

Why should it be a double? Just use String type and see what you get. Apply formatting on the output to convert to a double if you need to.

Guys I got the solution,

Its because iam using one column as int type in build data tabe activity accidentally the data is adding to that column

Now i have changed that to double

Thank you

1 Like