Lookups

0 views
Skip to first unread message

Gan...@j4fry.org

unread,
Mar 10, 2009, 5:41:43 AM3/10/09
to j4fry
Hi,

When using lookups for select boxes one might want to add default
values. Is it appropriate to add a a new aspectcollection and an
aspectcollectionmapping to the original aspectcollection? The new
aspectcollection could contain just the default value, the rest of the
data could come from the original aspectcollection.

Best Regards,
Ganesh

Michael Schneider

unread,
Mar 10, 2009, 3:47:56 PM3/10/09
to j4...@googlegroups.com
There are two aspects you have to consider. The default value and on
the other hand the specific order of the values.
Both could be configurable. I would prefer the specification in the
t_lookup itself. Therefor the t_lookup need two new colums
to define the default value and the correct ordering.

Ciao
Michael
Michael Schneider
mic...@schneider-mail.org



Ganesh

unread,
Mar 10, 2009, 5:59:33 PM3/10/09
to j4...@googlegroups.com
Hi,

I don't understand: We need 1 default value per aspectcollection. Why put it in t_lookup?

As for ordering: We already have got the additional id column that gives us the order in which the data where inserted. Could we use this?

Best Regards,
Ganesh

Michael Schneider schrieb:

Michael Schneider

unread,
Mar 10, 2009, 6:55:39 PM3/10/09
to j4...@googlegroups.com
You flag only the default value in t_lookup. All other default values are empty. The ordering based of sequences is difficult, because 
if you have a alphabetical order and you want to insert a new value, you have to change
all sequences. A more practical pattern is the usage of levels.

Michael Schneider



Ganesh

unread,
Mar 11, 2009, 6:14:00 AM3/11/09
to j4...@googlegroups.com
Hi,

Can you please explain how we could use levels to implement ordering? Here is a small example where you can please add the levels. When language is english I want to display 'United Kingdom' before 'Germany', but when language is german I want to display 'Deutschland' before 'Großbrittanien':

insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 1, 'enum', 'countries', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 1, 'language', 'german', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 2, 'enum', 'countries', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 2, 'language', 'english', 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 1, 'D', 'Deutschland', 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 2, 'D', 'Germany', 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 1, 'GB', 'Großbrittanien', 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 2, 'GB', 'United Kingdom', 1);


As for default values: My requirement is to have two lookups, one with default and one without. Here is an example:

lookup.enum['countries'].language['german'][LOOKUP_VALUES] delivers the available countries in german language.

When editing an address this is a required field, so we don't need a default value. When searching an address I want to use the same lookup, but I want to add an empty default value with key==-1. I thought of a new aspectcollection mapped to the old one that contains the default value in addition to the countries:

lookup.enum['countries'].language['german'].default['search'][LOOKUP_VALUES]

So how can I implement this while using a default column? Adding the default value to the original country list would spoil the basic lookup for editing too???

I thought of doing this (still open, how to get the correct ordering, but looking forward to your explanation of levels): 
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 3, 'enum', 'countries', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 3, 'language', 'german', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 3, 'default', 'search', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 4, 'enum', 'countries', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 4, 'language', 'english', 1);
insert into t_aspectcollection (id, aspectcollectionkey, aspectkey, aspectvalue, version) values (nextval('seq_t_aspectCollection'), 4, 'default', 'search', 1);
insert into t_aspectcollectionmapping (id, aspectcollectionsource, aspectcollectiontarget, version) values (nextval('seq_t_aspectCollectionMapping'), 3, 1, 1);
insert into t_aspectcollectionmapping (id, aspectcollectionsource, aspectcollectiontarget, version) values (nextval('seq_t_aspectCollectionMapping'), 4, 2, 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 3, '-1', '', 1);
insert into t_lookup (id, aspectcollectionkey, key, value, version) values (nextval('seq_t_lookup'), 4, '-1', '', 1);
Reply all
Reply to author
Forward
0 new messages