Should I use get_Units to find out if a Model or User parameter is a double or an integer or...?
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
You would use TypeName.
MessageBox.Show(TypeName(ParameterNameHere))
Example
Dim frank As String frank = "1222" MessageBox.Show(TypeName(frank))
Numeric parameter values internally are always Double.
(that's why you need to be careful when compare them for equality).
Units property is useful if user parameter contains text.
In this case Parameter.Units property returns "Text".
Cheers,
Yes, integers values of numeric parameters are stored as doubles.
You may find out that the e.g. length parameter is "integer" assuming some tolerance:
if abs(x - round(x,6)) < 0.000001 then <x is integer>
Actually suppose I should know if it is integer or double since I probably create the parameter!
Of course we always know if our parameter should be integer or not
But we should remember that it is rather dangerous directly compare “integer” parameter with the reference integer value:
If oParameter.Value = 1 then <do something>
because oParameter.Value could be equal to 1.000000000001
Be careful.
Cheers,