Writing a session property into a UDT tag parameter

Hello! im currently testing some functions in Ignition and can't seem to find a solution on either this site, their wiki and through the GPT.

Im Currently working on a project that use multiple PLCs, they alle run the same code. so i have imported them into the tag browser into folders.

i have created a UDT, called M1, containing parameters called:
MotorNumber : int;
PLCPointer: String;

i want to modify the PLCpointer parameter depending on the custom session property.

The process is as follows

i choose a PLC from a dropdown menu -> the value is written into a custom session property -> the value is loaded into a props parameter expression, which i have linked with the parameter from the UDT, i can't set it Bidirectional, so it wont write to the parameter. When i try to use a custom expression seperate from this, i get different kinds of errors.


i know im doing something wrong, but i cant seem to write the correct searchinput to find a solution

hope this have a solution :slight_smile:

My other attempts have been:

  1. Creating a refference tag, but i cant refference a session property
  2. using system.tag.write
  3. making an indrect binding which is linked to the session tag

This is backwards. Do not modify the tags' configuration. Simply create all of the PLCs' UDTs and other tags in different folders, by machine.

Point your UI at the desired folder using a string parameter containing the folder path. (Typically named tagpath in most applications.) Then your UI can use indirect tag binding to point the UI at the appropriate machine.

2 Likes

So that is what im doing "kinda"
most of the elements work like that, though i have a motor view page with 24 motors hence the UDT

and i have around 200 PLCs, i dont want to map each of the udts to the different PLCs so i would rather have a single UDT that looks at the {selectedPLC} session property, so i can ensure that the looked upon element is the same.

image

This is what im doing for my heartbeat connection and i assume that this is what you mean, where the session custom points to whatever folder it needs to look at.

i was hoping to optimize the process, by simple have the viewpath change.

though it might be impossible, or at the very least stupid?

i might have to look into how to automate the naming process then, when creating the instances of the UDTs.

thank you for the speedy answer!

Script the creation of all the udt instances using system.tag.configure. I believe you can also script the addition of device connections using system.device.addDevice. Much simpler and faster than hand assigning.

With a system of that size you are going to have to do a bit of legwork to set everything up regardless.

ChatGPT doesn't have enough knowledge about Ignition to be useful for Ignition specific things.

What Pturmel stated is the expected way of dealing with multiple of the same or similar devices across multiple machines. Most experienced users of Ignition expect this approach in one form or another.

ChatGPT has been trained on wrong answers (such as non-functioning scripts posted in questions) as well as right answers. It doesn't know the difference.

3 Likes

Which session? Ignition is a multi-user multi-developer environment. At any moment, there may be zero clients looking at a particular PLC, or more than one. Your architectural desire is simply impractical.

Make all the PLC folders with all of the nested motor or other device UDTs. Let your users have a UI where they can point their pages/views at any desired tag path.

1 Like

Im writing from my Home PC, but i have come to realise i had stared myself blind in the process of automating the process, i think the more correct(i am agreeing with your first solution) approach would for me to add all the udts and then i either find and replace to correct the instances of where the udts needs to look or maybe exporting it as a xml and then try a fix it there. i had mixed my internals with my externals.

Sorry for the trouble and thank you for the help.