Error: Decimal place issue when converting Double to String to add '%' symbol suffix
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
Below are the requirements:
I need to substract 2 percentage columns (current FD Own %) and (pq) column and find out the difference and then add the % symbol to display as a percentage substraction.
I was able to do that and create a new column= Change.
Now to add the % symbol at the end, i belive i need to convert the Double data type into a string and use the TOSTRING function to add that symbol.
When I add that I see that my 2 decimal places are now becoming like 10,12.
Can anyone help me in that?
The highlighted part of the screenshot is where I see the issue.
I have also attached with workflow file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@madhurinani you should just be able to do it all in one step with a Formula like the following, without the need to change datatypes etc for the sake of getting the right display (obviously replacing my dummy fields with your own):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @madhurinani,
to do this, you can directly use a formula and create a new text field using a formula like this one :
tostring (
[val_Number] * 100,
2)+'%'
it will convert the value in string, then I did a simple calculation on a field. It works perfectly on my side, you may want to use a round function before though.
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello All,
I am still facing the error as noticed by the client recently.
Step 1: I have created a new category column which is an nested if-else condition. Hence all the columns are in DOUBLE format. Works fine as expected.
Step 2: I convert the 3 columns in STRING as I need to append % symbol. (image attached)
Step 3: I create 3 formulas to append the %symbol for all the columns.
Problem: When I use the step 2 SELECT logic to convert the from DOUBLE to STRING, my values in the Change column change.
Attached pics.
How Can i resolve this issue. Any help would be appreciated.
Ideally the value should be 0.08% only
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I don't believe there is any reason to add the "Select" tool as that's not how you'd want to change it to a String field. I had a similar scenario just today.
The field was numeric, but I wanted to change to a string so I could add a '%' to the end.
I tried the first screenshot first and it wouldn't work because the "Data type" was still a numeric type, but you can update it right on the "Formula" tool as you see in the second screenshot.
As you can see, it worked like I wanted it to after that. Hopefully this helps!
#1 = Showed an Error
#2 = Worked great!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@calebdugger : I tried your logic and its not working. My data type is DOUBLE and I used your formula to convert into a STRING. It shows a Parse Error at char error.
I tried both ways, adding a new column as well as editing the same column.
