Special distinct list

Posts   
 
    
JayBee
User
Posts: 282
Joined: 28-Dec-2006
# Posted on: 04-Mar-2008 21:09:22   

I have an entity AAA that has two integer values, say x and y. When I show occurrences of these entities on the screen, I do not show the x and y values, but a combination of the 2. e.g. x = 2, y = 300, I show C2/300.

I have another entity BBB that also has the two integer values x and y. At the moment of creation there is no direct relation between AAA and BBB, but the allowed values of x and y are limited by the exclusive combinations present in AAA. When the user adds a record to BBB, I want him to specify x and y by selecting from the combinations present in AAA using the format C./..... (e.g. select C2/300 from the list).

I tried 2 approaches: via a View and a TypedView and via a TypedList both having x and y as there content. Is it easy to combine x and y into 1 column showing Cx/y as values?

Currently I have solved the problem by generating the formatted values using T-SQL in the view. I wish to have as little code as possible in the database. Therefor I prefer a solution in LLBLGen.

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 05-Mar-2008 06:32:09   

Since a TypedList is a DataTable, you can add a calculated column to it at the point it is retrieved. Give the new column a name and then use this name as the DisplayMember for whatever control you are using.

See the Expression property on DataColumn for a full list of what you can do in a calculated column including the concatenation you need for this job.

Cheers Simon

JayBee
User
Posts: 282
Joined: 28-Dec-2006
# Posted on: 05-Mar-2008 10:15:33   

OK, thanks