I see that I can use %\Element% as a substitute for the root element name, but is there a substitute for the root's child element name?
Feels like a dumb question, but I can't find an answer to it anywhere.
Please see Substitution parameters in data references and don't hesitate to ask any potential follow up question you may have.
I'll try to be more specific...
In the element Customer\Facility\EquipmentA\ComponentA I want to make an absolute reference, with substitutes for Customer and Facility, to an attribute in the element Customer\Facility\EquipmentB. I know that I can make a relative reference without substitutes, i.e. ..\..\EquipmentB|Attribute, but here I want to make a ComponentA template that isn't tied to a particular relative position.
The reference I want to make is %\Element%\%?%\EquipmentB|Attribute, where ? denotes the substution parameter I am looking for.
The answer is probably obvious to someone more experienced, but I am stuck.
It's easy to use substitution syntax for a given element or go back for generations of ancestors since each element has only 1 parent. For siblings or child elements there may be many so its difficult using substitution to know exactly which 1 among the many you are looking for.
Using your example of:
One workaround is to create a string attribute on %Element% that contains the value you wish to substitute. This string value could be static, or use a data reference like PI Point, String Builder, or Table Lookup. It could even be a PIPoint that is populated from an Analysis. How this string get populated is left up to you.
For this example, let's call this attribute Needle (since you are trying to find a needle in haystack). The substitution syntax could then look like:
Thank you very much for your response, Rick! It offers an improvement and possibly the best option available?
But the root child will always be the same for EquipmentB and template instances, so it should be uniquely identifiable by the ancestor relationships from the instance %Element%. The problem here is that the number of ancestors may vary from instance to instance preventing use of a relative reference. Since the element's root can be substituted by %\Element% I was thinking that there root child could have been substituted by something like%\..\Element%, the root child's child by %\..\..\Element% and so on.
Search for "Path Syntax" either in LiveLibrary or the PI System Explorer built in documentation. See if there's anything there that may help you.
Retrieving data ...