cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert string values to number format without losing dots(.) and commas (,) ?

0 Kudos

Hi Experts,

I am getting integer values in the form of string from backend in the form of JSON (eg:"Price": "100,00" instead of "Price": 100,00. Price value has dots ,commas and both).

so my sorting on sap.ui.table.Table columns is not working as expected sorting is happening on strings not on integers.

How to convert string values to number format without losing dots(.) and commas (,) ?

.i.e "1.234.567,89" to 1.234.567,89 So that sorting works correctly.

I tried with parseFloat in javascript but it is ignoring dots(.) and commas (,).

Accepted Solutions (0)

Answers (2)

Answers (2)

Sharathmg
Active Contributor
0 Kudos

The API parseFloat only works on the decimal points and not on number - thousands/millions. JSON returns strings so I am not sure if that could help you.

Implement a custom formatter to insert the commas or dots accordingly.

Regards,

Sharath

Joseph_BERTHE
Active Contributor
0 Kudos

Why do not change the type of your property ? In the Backend Server go to SEGW and select your project. Find the Entity Type and modify your property as an Integer.

Do not forget to regenerate the project and clear cache from both server (FES and BES).

Regards,