Currently I am getting some some numbers (codes) from Excel, and once they go through “String from Object” there are many more decimal numbers therefore the code does not match when trying to create dictionary
The format of the cells in Excel have been set to general, integer and text but the additional decimal places only appear after the String from Object node. Is there a simple alternative? Right now I am making it work by cutting characters but I feel like I’m missing something
Two thoughts, first: what is the result of replacing the string from object node with a+“” in a code block? I have a vague recollection that this method doesn’t have the trailing zero issue.
I was having the same issue importing from excel and string from Object. I found out that part of the problem was excel. You have to store your numbers as text in a way that it gives you an error with green little triangle on the top left corner of the cell in excel. To do this you have to first change the cell format to text and then only input your number value.
You can change this by changing the number format in File > Preferences > General > Number Format. However, this is still a problem if, for instance, one wants to add these converted number strings to a Revit parameter using something like Element.SetParameterByName, since the decimal zeros are also added to the parameter value.
I have tried converting the integer to a string using Python to no effect.
In the example below, String.Length does not consider the decimal zeros for integers, but the float with one decimal returns a length of 8 characters. This is very odd… Does anyone know why this happens and how to fix it or at least work around it? Thanks.