Prespective UDT and Bindings

Hello,

I'm sure this has been covered. If so, please point me to the correct area.

I'm used to tag binding/UDT in Vision. This is what it looks like in Vision for me.

-My "Home" page, I give it a special param of Site and its a String. I then Make a memory tag with SiteName, and its value is the name of my PLC project.

-I take an Allen bradley PLC tag structure. For example. I have a tag called PC 101. (Pneumatic Cylinder) Nested inside of this is my D2SD, Description tags,HOA, Interlocks, Name, and Stats.

-I drag and drop it on the screen, pick what template to use, and then add a button and group them. Add a special param to the grouped pictures. InstrType and InstrTag. Both Strings.

  • Once this is done I go to the project tree PC_101 template that i grouped, single click, drop to the bottom and hit the chain icon and give it an indirect tag refrence, refrencing the newly grouped devices.

  • After that i make the button open up my popups and pass the data from this page to the next. When its all said and done, i can copy and paste my projects and all i have to do is change the name of my devices when i'm making a new project or adding more devices.

That was a lot. I'm sorry. Now, Ive followed the Prospective videos and cant seem to get data to pass through or work like my vision udts. Can anyone shine some light on this subject for me please?

I'm not really sure which part you're getting stuck at, but you should avoid binding a UDT instance (using a UDTType property) to a custom prop (search forum for why).

Instead you should pass the path to the UDT instance to the object and then use indirect tag bindings to read the individual tags.

However, in perspective you can define udt drop params on a view and link specific UDT Types to the view. You can set it up to copy the tag path of UDT instances of that type which is dragged onto ankther view, into a specific param in your embedding view. This works in a similar way to how vision works with its template UDTtype params, except without the grief and limitations that come with using UDT Type params..

1 Like

Yeah I realized after I wrote this I forgot the "Where im at Part"

Please let me know where im going wrong.

-I have a home screen called Property binding for testing. Under Meta i added a Value parmeter with a Tag binding [default]Pizza_Truck/SiteName. This is direct but its ok.

Root -I built a screen called "Servo_Template". In the "Root" I put my InstrType, InstrTag, and Site. I followed another post that mentioned to put the tag path in the value location. I feel like i should have a indirect binding here.

View -On the Template screen or View screen called Servo_Template I followed the video that said click on your tag as if your binding it, then go back in and undbind and i added my block of tags and called it Servo_UDT.
I added the InstrType,InstrTag, and Site again. This time i bound them to the property from the root folder. /root.meta.InstrType. The same with the other two i built.

  • As well as the drop config portion, i added my Servo_UDT to the udts dropdown and matched it with my udt definition.
  • I'm not sure if i was supposed to do this but i added my InstrType and InstrTag to the dattypes drop down.

When i drop my tag into the view, it works just fine with a binding to the tag i dropped. I remove the binding from and it should either still work or i should have to put in PC in InstrType, and 101 In InstrTag. This does not work.
This image showing a bound from a drag and drop

This is after i un-bound it and put in the PC 101

Thanks

I think it would be worth rearchitecting per @nminchin's recommendation:

With this method, you pass in a single parameter, which is a string containing the tag path to your UDT instance, and then you create indirect bindings inside of your view based on that single input parameter.
There are several examples scattered throughout this forum. For convenience, here's a link to mine from the other day:

This input parameter can be configured quickly in your dropConfig of the widget (embedded view) that you are creating. Something resembling:

Example dropConfig:
{
  "udts": [
    {
      "type": "Your/UDT_Type/Here",
      "param": "udtPath",
      "action": "path"
    }
  ],
  "dataTypes": []
}

Under params of that same view, you'll need to create an input param called udtPath (or, match the value of 'param' in example dropConfig code above). Then, create a few view.custom properties which bind to actual tags (and UDT parameters) via indirect tag bindings - only bring in the data that you need, not the entire UDT.

1 Like

Sorry. This is still pretty confusing.

In the root folder of my view, do I need to do anything?
I want to pass the site info from my main page to anything that will be on it.

On my template, I added what you called udtPath. I called it Servo_UDT.
I added one view.custom called InstrTag.
The other is Site and it's hard coded because im not sure where it will get its info from other than the main page's root.

1 Like

I think that looks good :+1:

However, usually I would combine all of the tag path params into a single tag path within a custom prop using an expression to concat them together, if I'm passing parts of a full tag path to the view. It makes binding to it simpler

Looks like you are placing the binding ON the input parameter of your destination/child/embedded view. If your tag path is constructed via complex combination of params of a parent view, place that binding on the parent view, where you instantiate the embedded view for the child. Let the parent pass params to the child, try not to have the child request data from the parent.
Within the child view, avoid placing bindings on view.params. Just above that section is a view.custom section, where it's more appropriate to place the indirect tag bindings which are used throughout your view.

1 Like

I appreciate your help. Do you guys know of an example from exchange I can push into my project and mimic?
Whatever I’m doing isn’t working. I can grab a tag and drop it in and it either is bound and or I can change it to pass and it does so, I just can’t figure out how to make the binding work so it’s looking at the name of the tags.