Number to string don't work

Hi,
I have a problem converting a number into a “string”, the intended node no longer works.
Did you have this problem?
Do you have another node?
The other nodes I’ve found either give me rounding or text with too many zeros.

Or, you would have to remove the four last “0” from the text, but how?

Thank you for your help.

Use @1 Level in “num” input of Number.ToString node. Or try @@2

p.s. Isn’t “String from Object” doing what you want?

2 Likes

first flatten the list ot use leveling of list.

I don’t know Dynamo well, I don’t know how to change the @.

The “String from Object” node does what I want, but it adds 4 zeros and I cannot remove them for the rest of my script.
I have just tested a node which will perhaps succeed in removing the last 4 zeros.

@sandeep.kumawat , I added a “list.flatten”, but that doesn’t change anything, the node still doesn’t work.

This is just a visual bug - the zero’s aren’t really there. The issue should have been fixed in the latest Revit 2024 update. Try fully updating to 2024.2 and see if that resolves the issue.

II am on Revit 2023, and I confirm that it is not visual, Dynamo sends all the zeros on Revit.

you can allways shorten the string

Ah! I misinterpreted the issue.

In the String.FromObject node do you want the values to be [ 4.1, 9.2, 8.2, 10.6, 2.8, 8.5, 7.7, 9.0 ], or do you want [ 4.1, 9.2, 8.2, 10.6, 2.8, 8.5, 7.7, 9 ]?

If you want the former a String.SubString will work for you where you get the index of the decimal and add two to that as the length of the substring length.

If you want the later, you’ll want to remove trailing zeros and trailing decimals… not sure I have seen an easy node for that but it is doable. Try swapping the “0” characters with a space (" ") character using a String.Replace, then use a String.TrimTrailingWhiteSpace, and then use the inverse swap to put 0 back in place of any remaining space characters (" ").

I’m in 2024 at the moment so I can’t build a demo. Give it a shot and I will check back later to see and if your attempt doesn’t work will post something then.

By keeping the “object to string”, and deleting the 4 eros at the end of the “string”, it works, but it is not the most practical. Before Revit 2023, the “number to string” worked well.