I think it will do what I need it to but the issue is I cant seem to be able to access the specific data of the dataset.
The "Product code Query Tag" is an SQL query tag that pulls the last entry into a database containing a date and a product code. The product code isnt run but once every few days so i am trying to keep a tally of how many days a particular product code is run and therefore be able to alarm on x amount of days to trigger a PM
When I run the script I cant seem to pull out just the day and time to compare to see if it is a new day and increase the counter.
Here is the output
>>>
[Dataset [1R ? 2C], Good, Fri Dec 16 16:14:42 EST 2022]
[Dataset [1R ? 2C], Good, Fri Dec 16 16:14:58 EST 2022]
2
2
>>>
If I create a null value the values are different and it will copy the data over and increase the counter but it is comapring the entire dataset not the date. I have tried a million ways to parse just the date to compare but no luck!!
Here is the data in the dataset I am querying
Please Help I dont have any more hair to pull!!
That what I figured but I Tried that before also.
Here is the result of that code on my end
Traceback (most recent call last):
File "", line 4, in
AttributeError: 'com.inductiveautomation.ignition.common.sqltags.Ba' object has no attribute 'getValueAt'
What was executed
Product_Code_Query_DS = system.tag.read("[default]Product code Query Tag.value")
Product_Code_Compare_DS = system.tag.read("[default]Product_Code_Compare_Tag.value")
You are putting the .value inside the tagpath. Where it is redundant. The tag read call is still going to give you a QualifiedValueobject, to which you can then apply .value to get the actual tag value.
Tried that also
It doesnt give me the data though only gives me the Dataset? It also doesnt see them as equal and increments which is what led me to try and just isolate the date since it would be the only thing that changes.
Here is the output I get now
Dataset [1R ? 2C]
[Dataset [1R ? 2C], Good, Fri Dec 16 16:14:42 EST 2022]
Dataset [1R ? 2C]
[Dataset [1R ? 2C], Good, Fri Dec 16 18:04:32 EST 2022]
2
2
You need to do both things, as I did in my code above.
Use .value to go from the BasicQualifiedValue returned by system.tag.read to a Dataset.
Then use .getValueAt(row, column) to get a single scalar value out of that dataset.
You must do both.