Questions about UDT parameter types

Question on UDT parameter data types. Is there any way to prevent them from changing when using system.tag.configure to build an instance? We’re trying to build a .CSV import tool, and when we read an integer in the Excel sheet into the python dictionary it converts it to a string, but it’s still a string that could be cast to an integer (ie “1”) - when we import, what we’re seeing is the UDT param type on the instance is changing to string - we’d like it to stay as an integer. We’re at version 8.1.10…is what we’re seeing expected behavior or are there still issues with that subsystem - per this original thread, it looks like a year ago on the 8.0.11 they had issues with that subsystem.

If this is expected behavior, maybe I need to go to the feature request to ask for it to be modified, or at least have it be an option to disable. In general wouldn’t it make more sense for UDT params data types to be fixed (immutable in CS language?) and if the incoming parameter value from an import doesn’t match or can’t be cast to match, I would think it should fail the import and not change the definition properties of the UDT instance.

At what point exactly does the unwanted conversion happen ?
system.tag.configure allows you to explicitly specify the datatype, so I don’t think this is where the problem lies.
The rest of your use case / process is somewhat unclear, could you develop a bit ?

Our goal was to create a generic CSV import tool, so ideally we would not need to specify data types for each parameter. As long as the field header in the CSV matches the parameter name in the UDT, we want it to import (assuming value is correct type - ie can be cast appropriately). We’re using the standard python csv library to read the data from the file - and then create a dictionary of the param names and values for each instance we want to create and then pass that to system.tag.configure.

What we’re seeing is if we put a 1 in the CSV for a UDT integer parameter - then the instance gets created but the parameter type on the instance is now a string with a value of 1. The initial conversion from integer to string is happening with the csv import function - that returns all strings for values read from the csv, but we were hoping that since the UDT param type is an integer, that system.tag.configure would cast it back from string to integer when creating the instance.

Assuming you’ll ever get only strings or ints, you could test for ‘intness’ and configure appropriately:

tag = {
  'name': "foo",
  'dataType': 'Int4' if input.isdigit() else 'String',
system.tag.configure(path, tag)

I only ever did basic stuff with CSVs but I don’t expect there are too many types to handle ?
You might have to test for ‘floatness’ as well…