A (relatively) simple CRUD application on which I work has a lookup table which holds key-value pairs, some of which have child key-value pairs. These are used mainly in drop-down lists on the application front end.
Currently there is a RowStatus field to specify a key-value pair is active/inactive and is not to be included in drop-down lists. This is fine for creating records however it is an issue when updating historical records.
I plan on introducing a ValidFrom and ValidTo field in the lookup table for which 'Create' screens will use, along with the existing RowStatus field, to ensure that any items in the drop-down lists are valid for the current date-time. These would also be nullable in which case the underlying sql would ignore the field.
'Update' screens will continue to use just the RowStatus field, a bonus would be that the Update screens could also only display items which were valid at the time of creation, although business rules would determine this.
In practice, a user control loads key-value pairs from the lookup table and uses different criteria dependent on the page the user control is on. ie.
Create:
select * from lookuplist where RowStatus=1 and ValidFrom < sysdate and ValidTo > sysdate
Update:
select * from lookuplist where RowStatus=1
or
select * from lookuplist where RowStatus=1 and ValidFrom < CreatedOn and ValidTo > CreatedOn
Are there any issues with this approach that I've not considered?
Any ways in which this could be improved?
Code is in c#/ASP.Net/Oracle 12C but not hugely relevant.