There's an issue I haven't been able to resolve. This is the PI System Explorer I'm currently using (there's no way we can upgrade anything):
Let's say I have a table with a bunch of data, sort of like this:
As you can see, the "PRODUCTOR" column got repeated values for different assets. That table is defined as shown next:
I Have developed an element template in which I have created an Attribute Template that have a lot of childs, which, at the same time, have inner childs, something like this:
And some dummy (hidden) elements in order to avoid future errors (more on that later):
You see, POZO0 is a string, REAL0 is a number.
And there is also another attribute named NUMERO which changes with the name of the element.
The attribute named "Injection" brings the number of repeated items according to the "PRODUCTOR" column (double) from the table:
SELECT Count(INYECTOR) FROM [LCI Inj Well Test] WHERE PRODUCTOR = @[NUMERO];RWM=@REAL0;RWN=@REAL0
"W01" gets its value from the table, based on "NUMERO" value, and is a string:
SELECT INYECTOR FROM [LCI Inj Well Test] WHERE PRODUCTOR = @[|NUMERO] ORDER BY INYECTOR;RWM=@[|POZO0];RWN=@[|POZO0]
In order to not get the same value from "W01" into "W02", the table lookup configuration string for "W02" goes like this:
SELECT INYECTOR FROM [LCI Inj Well Test] WHERE PRODUCTOR = @[|NUMERO] AND INYECTOR <> @W01 ORDER BY INYECTOR;RWM=@[|POZO0];RWN=@[|POZO0]
And so on for the other elements (W03, W04, etc).
"Weight", gets its value using this, and is a double type:
SELECT FACTOR FROM [LCI Inj Well Test] WHERE INYECTOR = @[..] AND PRODUCTOR = @[|NUMERO] ORDER BY FACTOR;RWM=@[|REAL0];RWN=@[|REAL0]
I have implemented POZO0 to bring a dummy row from the table named 0000 with data 0, to avoid errors when there's no data to show, and the same goes for REAL0, that's why RWM and RWN are set to these attributes.
Then, I want to implement an Analysis in which it'll do a lot of things, but, as for now, I can't get it to work on a very simple one, my analysis is configured as follows:
Nothing fancy uh? It even evaluates my values as expected because, why would not?
InjectionCalc is of course a PI Point.
So, my problem lies on the fact, that if I set my analysis to get the value from W03 (as shown), it resolves as "Calc Failed", but, if instead of that one, I point my analysis to W01 (as in 'Injection|W01|Weight') it will suceed and will show the value and store it to the PI Point:
And... why? what's the reason? Why can't I get the value from the third child, and it suceeds on the first one? What am I missing?
I have tried with TagVal('Injection|W03|Weight') and I get the same result. I'm sure the user running the pi analysis service have enough permissions since otherwise it would fail everytime, and besides, is not the only one analysis running on the server right now, and all of the thousands of analysis already deployed are running just perfectly fine.
And what botthers me even more, is that if I try this on an attribute with no pi point, it'll work, of course it won't be saved to a pi point but it'll work, and, even more, if I try this not using templates, but creating one by one the attributes on an element (which, is not desirable like, at all, since there are thousands of elements to handle) then everything works, and the analysis doesn't fail, even saving the output to a PI Point. Why isn't the same result when everything comes from a template?
It'll be awesome from you people, if you help me resolve this issue. Thanks a lot in advance (and sorry for the long question).