I wanted to call attention to two things about UDT parameters that plagued me for a while. One is more of a quirk, and the other is a bug as far as I can tell. This was tested in version 8.1.1.
- (Quirk) String parameters initialize as a null value/None datatype, rather than an empty string
This doesn’t seem wholly surprising, but it can be counter-intuitive when a parameter is defined as a string in the UDT. The parameter can be switched from null/None to an empty string by clicking into the parameter value field and committing. The same may be true for integer/floating point parameters, but I haven’t tested.
- (Bug) Passing a null/None string parameter to a nested UDT passes the literal value ‘null’ rather than null/None
This took a while to identify, as the parent parameter (null) and child parameter (‘null’) appear the same in the tag browser. If you’re doing scripting with parameters and need to check if they are empty,
if not parameter will only work reliably for a parent/unpassed parameter. For a child/passed parameter, something like
if not parameter or parameter == 'null' will be necessary to check for when the string is empty OR literally the string ‘null’.
IA team, let me know if you need a more structured example to reproduce the issue and I can work something up.