I understand that the parent element has a string attribute that (1) is not a PIPoint and (2) contains the name of child element.
For the attribute on the child element, is it a PIPoint? I see you used the plural analyses and results so I am hoping you are historizing the calculations. I also assume this attribute on a child element is named the same on all potential child elements?
Thank you very much for your answer.
You are right, the parent has a string attribute, where, in the configuration time, I will write the name off the child element.
The attribute in the child element is not a PIPoint. (this is my problem)
The child elements perform some analyses, the results of them are written in attributes without history; except for the attributes that belongs to the elements that was indicated in the parent’s string’s attributes.
All the child elements belongs the same template.
1 of 1 people found this helpful
Controlling the behaviour of an analysis to write to history PI Points or not can only be done in design-time, not runtime. So you can't switch which child element will write history from another attribute.
If tried to be creative with the string builder, because that is the only DataReference that lets you work on string attributes. But nothing really worked to compare the parent element attribute value with the current element's name.
So going the NoOutput route on the analysis this worked for me:
- One string builder attribute "MyName": "%Element%";
- One string builder attribute "ChildToWrite" taking the attribute value from the parent: '..\|NameOfChild'
- And one analysis: if ('ChildToWrite' = 'MyName') then 1 else NoOutput()
If the use of NoOutput() does not fit your scenario, please share some details on what you try to achieve functionally so we can have a look for alternate solutions.
2 of 2 people found this helpful
I was playing around with this some more and may have found an undocumented feature of Asset Analytics. Let me also offer a strong warning: this feature may not be available in future versions of Analytics, and your analysis must be periodic since a change in the source value does not trigger a change in the pointer name.
Let's look at some attributes on the parent element:
The child attributes to Lookup are static string values. Lookup itself uses StringBuilder to compose a reference based upon its children.
The source attribute referenced by ".\Child1|Static Attribute" is:
Note that is not a PI Point. Now the analysis could look like:
Here's the funny thing. I like to break my expressions up into smaller steps so that I can see what happens for each step. That doesn't work here. You must put TagVal(TagNum(PointerName)) together.
Another thing I tried was TagVal(TagName(PointerName)) but it failed too. The only thing that worked is as shown, which is why I suspect its an undocumented feature.
Nice solution direction! Not sure why it does not or should not work. Seems valid to me.