Implementing deadband

Hi!
I would like to implement a deadband, where the deadband is determined by the fields, and where the deadband might change dynamically.
lets say i have some table ‘values’

TS Value name
14:03:05 5 temp1
14:03:06 6 temp2
14:03:07 5 temp2
14:03:08 7 temp2
14:03:08 7 temp1
14:03:09 3 temp2
14:03:09 6 temp1

And some collection of the deadbands associated with the names
temp1: 2
temp2: 3

the result i want is:

TS Value name
14:03:05 5 temp1
14:03:06 6 temp2
14:03:08 7 temp1
14:03:09 3 temp2

What is the best way to do something like this? Can this be done with a CO even if the deadbands change, and if so how/where should they be stored?