General Rule help needed!

That doesn’t seem to e a database related requirement.
I’d create a number item for counting.
Trigger a rule to set it 1000 whenever (at system start? when the date changes? when a button is pushed?)
Trigger a rule from the sensor item changing to OPEN and have that rule add 1 to the counter.

I’m not sure how that helps with

Might be some ideas here