125
Views
3
Comments
[Advanced Excel] Reading decimal vales from cell
advanced-excel
Service icon
Forge asset by Carlos Freitas
Application Type
Traditional Web

I'm reading a cell value which is formatted as Number (with 2 decimals, with thousand separator).

When using Cell_Read action the returned cell value is converted to string according to the server regional settings. So if server settings set comma as decimal separator returned value will be, p.e., "123,456". If in your oml caller you then try to convert this text value to decimal using TextToDecimal (which according to documentation only allows dot as decimal separator) it will fail, setting result to zero.

EPPlus uses invariant culture (dot as decimal separator), so does OutSystems conversion actions. Shouldn't the man in the middle also?

Maybe something like this?


UserImage.jpg
Alexandre Yip

Hi João, 

as you said 

TextToDecimal (which according to documentation only allows dot as decimal) 

Another workaround is to have a separate action which could apply the following logic

1. retrieve/get

 the group separator and decimal symbol 

2.replace the group separator by "" 

replace the decimal symbol by dot

3.apply the TextToDecimal to the result

Hope that it helps 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Alexandre,

The post you replied to is from 15 March, I don't think the OP is still waiting for an answer :). Also, the OP seems to suggest a fix in the code, more than asking a solution.

UserImage.jpg
Joao Melo

Hi Alexandre.

I get your logic but how do you retrieve the group separator and the decimal symbol from server regional settings?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.