SQL Tag Event script

I have a SQL tag query that looks at a table constructed by a transaction group.
The following is my query in which is saved to the tag as a dataset
SELECT top 2 DateTime from Cast_Time order by DateTime desc

The script doesn’t seem to launch. is it because ignition isn’t looking directly at the values in the dataset? If so what datatype would be best to save two datetime values from sql into.

I want to be able to write this value onto a memory tag so that for all the clients can have the correct time being displayed

On line 9 remove the indentation. Your function call is inside the function.

I didn’t notice that thank you.
quick question would I be able to incase line 9 within a if statement that looks at another tag’s Boolean value?

Should be no problem. You could use system.tag.read(your_tag_path) to read the value of the tag and then proceed according to its value.

tagValue = system.tag.read(some_tag_path).value
if tagValue:
    system.util.invokeLater(DatabaseQuery, 5000)