User Defined Data Type [UDT] Tutorial - Explanation, Usage, Examples & Custom Definition in RSLogix 5000

User Defined Data Types or UDTs are commonly used in Programmable Logic Controller Programming in order to group data and maximize code reusability. This structure allows the user to combine any of the existing data types into a package which can be reapplied multiple types across the program, be exported and imported into other structures.

This is a companion discussion topic for the original entry at

Can you create UDT while online or does the PLC has to be offline just as the case for creating AOI?

1 Like

You can add UDTs online. However, you can’t make changes to them as freely as you can offline. For that reason, I always recommend creating them offline and importing them into a program (can be done online). Once in place, if you need to make changes, you must delete all instances of that UDT and re-import.

Hope that helps,

1 Like

Is it possible to add an UDT inside another?

You can certainly nest UDTs. One caution I’d give against that is when you copy the parent UDT into a different program/PLC, it will break unless you copy all the ones used within as well. So you must be careful when you “import/export” the UDT that contains nested UDTs in it.

I’m looking to add to an existing data type. What would the best practice be? Should I edit data type offline and then push a download? Or create similar but new UDT and change names of all instances of existing one?


I’ve gotten both routes. It really boils down to two things:

  1. If the process must remain online, you can’t perform a download. You must go the “new UDT” route.
  2. If it’s extremely tedious to redirect all the instances to the new UDT or they are utilized in routines that may shut down the process. You must go the offline route.

I always prefer to go offline, edit, and download unless as mentioned above you can’t shut down the process.

I have issue with UDT DATA type.
I am programming in RsLogix5000 and create recipe program i want save all data according recipe parameter.
is should store when upload and download in anther plc.
I am using Cop instruction. tag element -name-element data type string, tag data type udt.
i am aslo attaching the picture which i have taken from another pc but i dont know how to create such like this.
please suggest how make program for recipe and how make tag as i have attached thanks
UDT data type

Hi Alam,

I’m not completely clear on the issue you’re experiencing. You’ve designed a UDT to store a recipe. Where are you seeing a problem?

I see that you’re using the COP instruction to send over the name of the product? What are you trying to do here?

I’d need more information to be able to help.

Thank you,

1 Like

I need to change an existing UDT that uses a nest UDT data type. Luckly enough the previous programmer had made 2 memeber labeled " V_spare1" “V_spare2”. What will the best process to make my desired code changes ie to keep naming convention should i use the current UDT memeber names and programme online and a the next shutdown process window change the names to the correct tag and do a download with the PLC stopped. Or is there a cleaver way i can rename the memebers of a nested UDT online.

UDT web queery

1 Like

Excellent question David.

So UDTs, as you probably know, can’t be changed as long as they’re used somewhere in the program. Therefore you have two options:

  1. You import the new UDT into the program and then make the changes necessary to the code to “migrate” the old usage of the UDT onto the new one. This doesn’t require a download.
  2. You backup the current program, make the changes, download.

Personally, I’ve used the first approach in a lot of scenarios as it was difficult to get time to download. However, if the changes were extensive, I’d always go with the second approach; it becomes to difficult to “untangle” the code and migrate without any issues.

Based on what you have, I’d probably create the new UDT and move the code over while online. in other words, you add the new UDT, you edit the rungs to use the new data types and then commit the changes. Of course, if you have many of these, it can be a problem.

Hope that helps…

1 Like