Using variables in compare methods

Can I pull data from Dude’s database as a variable name, instead of using a literal counter value in a compare method?

Use case: I wish to compare the previous counter value to the most recent counter value in an SNMP service probe.
!=

If this test is true, the service is up. If this test is not true after 15 minutes, I wish to send a notification.