Since we’re talking about binding to folders… it would be very nice if folders did have some properties you could read from them like alarm counts of all of the priorities and ack states. I think there is already talk of adding this in, but the concern was performance impact
My only comment to this, Is if we should expect nothing, it should probably be an exception instead. For example if you read a tag path that doesn't exist you get an error, but since a folder isn't a tag you might think you should get a similar error.
I do agree though, better to get nothing or an error than a potentially "random" number
I would expect the same thing here. When I bind a UDT to a perspective prop, it brings in the structure beautifully. When I update the UDT, so does my perspective binding. It's like Vision drop targets for perspective. This is valuable as heck. I just found out today that binding a folder of tags returns an integer.
I found this thread while looking for a way to bind to a folder of tags. Example I have a folder of udts.. I was going to search through them to find which one might be relevant for some linked data.. However I was getting a 2 and thought I might be doing something wrong. Does anyone know of a good way to iterate through a folder of tags?
What is your goal? What you've asked is very vague. I could say you can just use the tag browser to look through the tags, or the opc browser, or you could use system.tag.browse or tag.query programmatically
Native Ignition expressions don't have any ability to loop, but @pturmel's (free) Integration Toolkit module should "just work" with the meta jsonValues node talked about here.
There are a handful of Group-* UDT instances, each with members like:
valueA
valueB
valueC
...
The OtherUDT-* instances follow a similar pattern and contain a corresponding set of values (including a field equivalent to valueA).
View Setup
In my view, I have multiple components:
One component is parameterized with something like view.params.groupIndex (e.g., Group-1, Group-2, etc.)
Another component is parameterized separately with view.params.otherIndex (e.g., OtherUDT-1, OtherUDT-2, etc.)
Originally, these components were independent and did not need to reference each other’s data.
New Requirement
Now I have a need to relate data between these two sets of UDTs.
For example:
If valueA in a Group-* UDT matches valueA in one of the OtherUDT-* instances
Then I want to retrieve and display valueB from that matching OtherUDT-* in the first component
What I’m trying to accomplish
Given a value (like valueA) from one component/UDT, I want to:
Search through all instances in another UDT folder (OtherUDT-*)
Find the instance where a specific member (valueA) matches
Return a different member (valueB) from that matching instance
Question
What would be the best way to implement this in Ignition?
Is there a binding-based approach (e.g., tag folder binding, indirect binding, expression structure, etc.) that can support this type of lookup?
Or is scripting the expected approach for this kind of cross-UDT “search and match” behavior?
More broadly, is there a recommended pattern for structuring tags when you need to correlate data between multiple UDT instances like this?
Sidenote: I just installed the Integration Toolkit last week. Maybe that is the answer to what I am trying to do. I'll try doing what you suggested paul
We do similar things where one UDT A needs know the tagPath of another UDT B based on a value in the UDT A. We use a dataset in UDT A that has two columns. One for the value, and the other for the UDT B tag path. Then using the lookup expression we can quickly find the tag path for UDT B. It does take some setting up, but most of the time that can be accomplished using a script to setup the datasets.
Personally I would see how adding a string tag to the Group UDT and a tag change script on the value in the Group UDT. The tag change script would go through and look for the Other UDT that matches the value and fill in the string path to the UDT instance (or empty string if none). Then you have the path for any other indirect bindings you may want to use and the path updates whenever the Group UDT value changes. Except you many need to address what happens if the Other UDT value changes (may have to add a list of related Group UDTs that match the Other UDT to the Other UDT so you could go clear that path when it changes).