Better way to create a lot of UDTs at once?

Unfortunately, the Multi Instance Wizard for UDTs leaves much to be desired. I have just a list of names of UDTs, and they’re going to all be the same type that I need to upload. Rather than go ahead and create them one by one (>100 tags), I’d love to know if theres a better way to do this. Is there?

Scripting

I use Excel to document much of the system details that I am working on. Using this data and some VBA I’m able to generate tag instances for my Logix programs as well as various SCADA programs including Ignition. It also generates some basic logic for IO mapping and configuration data I can read or write to/from a PLC. For Ignition Excel generates an .xml file of tags I require, then I just import into Ignition.

Two typical tags that might make up my .xml file (this could be 100s of tags pending the system I’m working on). In this case, these are my analog input tags.

 <Tag name="TC510" path="" type="UDT_INST"> 
     <Property name="Value"/>
     <Property name="DataType">2</Property>
     <Property name="UDTParentType">Machine/AnalogInput</Property>
     <Parameters>
         <Property name="IO_Raw" type="String">Local:2:I.Ch6Data</Property>
         <Property name="Description" type="String">Vacuum Chamber Temperature Probe #10   </Property>
         <Property name="Tag" type="String">TC510</Property>
     </Parameters>
     <Tag name="ScaledValue" path="" type="EXTENSION">
         <Property name="EngUnit">DegC</Property>
     </Tag>
 </Tag>
 <Tag name="TC511" path="" type="UDT_INST"> 
     <Property name="Value"/>
     <Property name="DataType">2</Property>
     <Property name="UDTParentType">Machine/AnalogInput</Property>
     <Parameters>
         <Property name="IO_Raw" type="String">Local:2:I.Ch7Data</Property>
         <Property name="Description" type="String">Vacuum Chamber Temperature Probe #11   </Property>
         <Property name="Tag" type="String">TC511</Property>
     </Parameters>
     <Tag name="ScaledValue" path="" type="EXTENSION">
         <Property name="EngUnit">DegC</Property>
     </Tag>
 </Tag>
1 Like

Partially solved - I’d still like to know if there are better solutions out there but for my project, I exported a dummy UDT to CSV (probably could have been xml too but CSV worked well for a UDT w/ no overrides) and copied the text that accompanied each UDT into Excel, then used Excel’s substitute() to remove the dummy name and insert the UDT name I wanted for each line. Then I copied out the substituted lines into a text editor and saved it as a CSV. Because its Excel it did some weird things like adding some quote marks but after figuring that out it was fine.

If you have allready defined your UDT’s and only want to create instances, a nice way to do this is by using system.tag.addTag(). I usually create a list of UDT names in Excel and save this as a .csv file. You can then loop through the file by scripting and add all the instances in one click :slight_smile:

I forgot about that - I think I did it wrong the first time I tried for this sort of thing and cleared it from my memory… but I should give it another try next time I have the opportunity, sounds like its probably one of the best ways for simple tag adding like I’m doing.

I generally export one instance (or even a folder of non-udts) as XML, then write a little bit of PHP around it. PHP is Turing-complete, so it’ll do the craziest complex structures. The PHP output is an XML file I can import back into the designer.

Do you by chance have some instructions how you use this? I have a simple script that generates a list of tag names that will ultimately be used in the multi instance wizard, but want to automate this even further.

Here is another tread regarding the same.