How to prevent Element.GetParameterValueByName from changing text of numbers into numbers


#1

I have text parameters that encode the floor number and instance, e.g., 103 is the third device on the first floor. The problem is in the basement, which the architect has designated level 0, so the third one in the basement would be 003. The node returns 3, which messes up an algorithm I have that’s looking for 003. Is there a way to tell the node to import the text as is?


#2

Hi @REXWAVE,

What have you done about this problem? Can you share it as a Dynamo chart?


#3

It turns out that I’m wrong about where it’s happening. I put a Watch on the node and the output is fine. I’ll follow down the chain to where it turns sour. An export to Excel is involved, so it may be that the receiving cells aren’t set to text. I’ll report when I know more.


#4

If there isn’t a problem with this issue, can you turn it off?


#5

OK. How?


#6

@JacobSmall Helpp ! :slight_smile:


#7

Likely that the excel data is reading or writing the values as text. Uses a ‘ before your values to ensure things write as text. Make sure ‘read as strings’ is set to true to ensure you being them back into Dynamo correctly.

If this topic is all set let me know and we can close it out.


#8

Thanks, Jacob.
I fixed it by setting the columns’ data types of the import excel sheet to text or general (for the numbers). I turned off the OverWrite of the export node so it won’t kill the excel settings (don’t know if it will or not, but I need to get finished).
I haven’t figured out how to point the Import node to the parameters of interest. What’s a resource for this info?
The “thread” classification, same as all forums, is a bit frustrating because the problem often manifests itself in one place but the breadcrumbs lead somewhere else.
Please turn off the thread in your discretion. Do I get that your the admin?
Cheers.


#9

Could you show us where things go wrong?

Share your graph and part of the excel for example.
(you did make sure the parameters are text fields as you mentioned right?)


#10

3Pinter, this was solved. It turned out that the Excel sheet columns were set to General format, so they treated text strings with leading 000’s as numbers.
Cheers.