Custom Data Driven Provider is showing stale tags

I’m looking into driving a custom driver and the values for my tags within Ignition are updating, but they are ‘stale’.

From my understanding of the custom driver whitepaper, I need to:
[ul]
[li]- update the tag value and the valuechange column to the current datetime in sqlt_core[/li]
[li]- update the lastexec' to the current datetime, andnextexec` to the current datetime plus the scan rate.[/li][/ul]

Example (python) code:

import MySQLdb, datetime, time

try:
        conn = MySQLdb.connect ( host = "localhost",
                                 user = "ignition",
                                 passwd = "password",
                                 db = "drivertest")

        cursor = conn.cursor()

        for x in range(0, 1000):
                d = datetime.datetime.now()
                now = d.strftime('%Y-%m-%d %H:%M:%S') # timestamp
                next = (d + datetime.timedelta(seconds=1)).strftime('%Y-%m-%d %H:%M:%S')
                value = x

                # update the value
                cursor.execute("UPDATE sqlt_core SET intvalue=%d, valuechange='%s' WHERE name='TestTag'" % (x, now) )
                print "set intvalue=%d" % x

                # update scan class instance
                cursor.execute("UPDATE sqlt_sci SET lastexec='%s', lastexecrate=1000, nextexec='%s'" % (now, next))

                # wait some
                time.sleep(0.1)

except MySQLdb.Error, e:
        print "err %d: %s" % (e.args[0], e.args[1])

Hi,

I would double check that everything is lining up linking the tag to that sci row. The tag has a scan class id and a driver name. The scan class id must map to an entry in sqlt_sc, and then there must be an entry in that sci table for that id, and the driver name set for the tag.

Depending on the version of Ignition (I think it was put in for 7.3.5), there’s a logger for external tags meant to help track down why things are stale. Go to Console>Levels and search for “ExternalTags”. It should be something like “…ProviderName.ExternalTags”, and if you change it to trace, it will print out stats about what it sees.

Also, this shouldn’t come into play since your db is on localhost, but the staleness will be calculated against the DB’s “CURRENT_TIMESTAMP”, so you might want to check for a discrepancy there.

Regards,