# Setting datatype parameters in new UDT using SDK

**URL:** <https://forum.inductiveautomation.com/t/setting-datatype-parameters-in-new-udt-using-sdk/15023>\
**Category:** Module Development\
**Created:** [August 10, 2017, 12:16am UTC](https://forum.inductiveautomation.com/t/setting-datatype-parameters-in-new-udt-using-sdk/15023 "2017-08-10T00:16:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blakerider](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@blakerider](https://forum.inductiveautomation.com/u/blakerider)\
**Post date:** [August 10, 2017, 12:16am UTC](https://forum.inductiveautomation.com/t/setting-datatype-parameters-in-new-udt-using-sdk/15023/1 "2017-08-10T00:16:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![blakerider](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@blakerider](https://forum.inductiveautomation.com/u/blakerider)\
**Post date:** [August 11, 2017, 9:43pm UTC](https://forum.inductiveautomation.com/t/setting-datatype-parameters-in-new-udt-using-sdk/15023/2 "2017-08-11T21:43:18Z")

</div>

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));
```
