Setting datatype parameters in new UDT using SDK

I’m trying to figure out how to set properties in new UDT instances. My UDT, ‘sofcReads’, has two string parameters. It’s easy enough to create the tags from code I found on another post. Here’s my code:

ComplexTagDefinition newInst = new ComplexTagDefinition(this.referenceList.get(i),TagType.UDT_INST);
newInst.setAttribute(TagProp.UDTParentType, new BasicTagValue(“sofcReads”)); context.getTagManager().addTags(TagPathParser.parse([default]sofcReads/sofc1/"),Arrays.asList((TagNode)newInst),CollisionPolicy.Overwrite);

However, I haven’t been able to figure out how to set my parameter values. Any suggestions would be appreciated.

Thanks!

1 Like

I think I have this figured out. I tried adding the following code and it worked, though I’m not sure if there’s a better way to do it:

        		PropertySetBuilder psb = new PropertySetBuilder();
        		BasicProperty<String> p =new BasicProperty<String>("scale",String.class);
        		BasicProperty<String> bit =new BasicProperty<String>("bitmask",String.class);
      

        		psb.set(p, "2");
        		psb.set(bit,"4");
        		PropertySet myPS = psb.build();
        		newInst.setAttribute(TagProp.ExtendedProperties, new BasicTagValue(myPS));
1 Like