开发者

Single or Multiple IDs for same value but in different states/questions

I have a lookup value "Unread". It is used here: Mail can be read or unread. (So i have ID 10 = read and ID 11 = unread). Now in the UI I have display filters where i can sort message by predefined filters, one of these is 'Unread' So the question is: Are the IDs in both cases going to be 11 or do i create two separate values for Unread - one for the message state and one for the display sort?

The use of this d开发者_运维知识库ata is 2 folds:

1) Reference its main action based on the FK lookup ID

2) Reporting: If i want to see how many users sorted using Unread filter for Unread mail, in which case can i get that number easily - by using two IDs (one for each question (message state and display sort) or one ID only?


The status value of read/unread is a property of the message item, not of the GUI or the user. The filter state selected by the user is a property of the user, not the message.

If it makes sense to you to have the same values used in these two similar, but independent code columns, then that is fine.

You need to store the message state as a column on the message (unless you want to track the history of message state, in which case it has to go into a child table of the message). You need to store the current filter selection state for each user on your user table. I can't imagine why you'd want to historize that so a single column on your user table should do the trick.

If unread in the message table is "11" and unread in the user table is also "11" then that's fine, but it's coincidental and you want to be careful about making any assumptions in your code about this. When you start adding in other filter combinations the whole scheme could come crashing down on you unless you're committed to having matched pairs of attributes in your user/gui filter selection table and whatever message attributes line up with your filter options.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜