Number format, writing 4E-05 instead of 0.00004

Hi all,
I am facing a problem with the format of a calculated fields in a datatable.
When writing these results into .csv, the format is automatically switched to Scientific mode and I get 4E-05 instead of my goal format: 0.00004.

Anyway to solve this issue, (without some string parsing method)?

Thank you all,
Best Regards.


P.S: I have already tried to convert the fields ToDecimal and ToDouble and then to String but got the same issue.

Are you using Excel to view the data? (try viewing in notepad)

CSV files will not transform the data into scientific mode.

Hi @AhmedTM

Welcome to the community!!

Check whether this set of activities can help you to get it sorted.

2 Likes

I am trying to solve the same problem … and I just tried these activities …but also doesn’t solve the problem …

image

For viewing: I have tried both (excel and text editor) but still got same issue,
I have noticed that writing the output table into .xlsx files does respect the format I am looking for “0.00004”.

I want to understand why is this issue happening when writing the datable into .csv files with Write CSV activity.

Thanks,
Regards.

I am trying to do this … but still I dont find a better way … if you find something else …please share it here

Is the datatype of your column a double?
When writing to CSV it takes whatever datatype provided and outputs it in the same format.
Example Datatable using different datatypes

Double,String
1E-05,0.00001

This is exactly what is seen in the csv.

XLSX files uses excel formatting to retain generic (text) formatting which is why it doesnt happen.

The only nice way is to use string formatting.

I had a similar problem. I fixed it using string type and adding “variable” = “variable.toString(“F6”)”.
If I only use the string type, I still have 1E-05 when I write the .csv file.

Hi,

I have noticed the same as mentioned in your comment, I was actually adding datacolumns to my DT that would be calculated fields, I chose System.Double as TypeArgument, but this doesn’t suit the format I would like to have in my output .csv file.

Solution: switching to String type column, the output .csv format (ex: 0.00004) is maintained.

Thank you for your comments,
Regards.

1 Like

Your welcome :slight_smile: Happy to help, if you mark my post as a solution it can help others find it quicker in the future.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.