Hi everyone. I have an easy chart which I would like to get 2 maximum values from. Since the recorded values are analog, I would like to catch the “peaks” if that makes sense. I can get one maximum value, but I am not sure how to get a second peak value. I tried with:
#get values from volume for 2 maximum values
if event.propertyName in ('startDate', 'endDate'):
startDate = event.source.startDate
endDate = event.source.endDate
tagPath= '[default]Work Tank 2/Work Tank 2 Volume Imperial Gallons'
Max = system.tag.queryTagHistory(paths= [tagPath],
startDate=startDate,
endDate=endDate,
returnSize=2,
aggregationMode='Maximum')
event.source.parent.getComponent('Max1').value = Max.getValueAt(0,1)
event.source.parent.getComponent('Max2').value = Max.getValueAt(0,2)
but get an error:
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException
caused by ArrayIndexOutOfBoundsException
I’m sure it’s due to using Array(0,2), but I don’t think that would get the correct value anyway, as it would return the 2nd highest value, which would be a data point immediately next to the maximum. I’d like to find the maximum value of a secondary maximum. Sorry for the confusing write up.