I am testing my function on the Script Console and it works:
(however if I use this code as a function on a Share Script, it doesn’t work)
stepX = 10
#this is my DataSet tag
tagValue = system.tag.read("MX_Seating/R1Cx_01B/Criticals").value
def valueIn(tagValue, stepX):
listOfRowValues = []
for row in range(tagValue.rowCount):
listOfRowValues.append(tagValue.getValueAt(row, 0))
if stepX in listOfRowValues:
print "CC"
else:
pass
valueIn(y,x)
The following is my definition on the Shared Script: shared.FindValue
def valueIn(tagValue, stepX):
listOfRowValues = []
for row in range(tagValue.rowCount):
listOfRowValues.append(tagValue.getValueAt(row, 0))
if stepX in listOfRowValues:
return "CC"
else:
pass
I am using a Dataset Memory tag (called "Criticals"which has one column and 4 rows as one input, and an integer Memory tag as another input (called “Value”). My goal is that if the Values is in the list of Criticals, I would just write a string on string (“CC”) on a Memory Tag.
The Dataset tag has 1 column and 4 rows with 4 values:
But, this is not working: I already tried the following:
I input this expression on a expression tag, string type:
runScript("shared.FindValue.valueIn("+{[.]Criticals}+","+{[.]Value}+")")
That didn’t work:
I also tried the following expressions on a expression tag, interger type:
if(lookup({[.]Criticals},10,-1,"StepNo"),1,0)
if(lookup({[.]Criticals},{[.]Value},-1,"StepNo"),1,0)
None of them work. Now, my assumption is that there is some modification I need to have to compensate for the fact that I am using a tag, Dataset, as my input for my function. But, I am not sure of the correct format, up to this point.
Does someone has an idea on how to make this correction?