Reputation: 7383
A common issue I am faced with is having derived information that must be displayed on detail pages and in overview tables.
For example, there maybe a status for 1 item based on the status of multiple sub-item's status value. It seems storing the derived status for the main item would be wrong but sorting and filtering for this information can be troublesome as well.
What is the best way to handle this situation?
Upvotes: 1
Views: 226
Reputation: 222
I'm not sure, that I got your question correctly. To explain how I understood your question I'll use example.
Example: we have a car (item) and its parts: wheels, engine, doors etc. (sub-items). The status of the car is derived from the status of its parts. For example: if the status of engine is 'broken' then the status of the car is 'broken', or if the status of doors is 'missing' and engine is 'OK' then the status of the car is 'usable'.
If this example corresponds to what you meant then you have following options:
These are the options, but only you know specific information (database load, complexity of derived value calculation algorithm, what is more often sub-items statuses change or item statuses reads etc). So only you can decide what suits with your case.
Upvotes: 1