Q about select distinct rows from typed list

Posts   
 
    
young
User
Posts: 6
Joined: 27-May-2009
# Posted on: 27-May-2009 16:02:24   

Hi,

Yesterday I purchased a license for 2.6 PRO. I love it. Thank you. I'm using this in a ASP.NET 3.5/SQL 2005 website I'm redeveloping. In this instance, I need to access rows from multiple related tables such as Categories, Subcategories, Products, ProductTypes, ProductSizes.

and get all fields by name on every row, like this:

Categories.CategoryName, Subcategories.SubcategoryName, Products.ProductName, ProductSizes.ProductSize, ProductTypes.ProductTypeName Subcategories.Weight, Subcategories.Width, ...etc.

According the the docs, an easy way to join all these is with a Typed List. So I've got this list filtering and sorting based on code from your example in Self-Servicing. However, there are many pages where I need a subset of this Typed List, specifically returning the list with all fields but with distinct Subcategories.SubcategoryName.

The data can have 50 products per subcategory and 50 subcategories per Category, and so the resultset of the list, 1) has a lot of rows, and 2) as a result, the Subcategorynames are repeated X number of times according to the number of products.

The subcategories table has many detail fields that are common to all containing products. I am try to get all rows and columns from the typed list with distinct subcategory names.

How can I do this. Do I need a different approach? Do I have to use LINQ? Any direction would be much appreciated.

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 27-May-2009 16:13:50   

I think what you want to do is a tepical Master-Detail pattern. You should have a Master Control (Grid, List or whatever) that displays the master data columns...like SubCategory And then another Detail control to display the selected Category details (rows).

If you want all details displayed, then you might consider using a Hierarichal Grid, or define a grid inside the cell of the another master one.

young
User
Posts: 6
Joined: 27-May-2009
# Posted on: 27-May-2009 16:28:32   

Hi,

Thanks for the reply. Yes, I dont believe that work in my scenario, as I need the display of information on the page to be like the following:

I can filter the list on category to get the desired category.

Then for all distinct subcategories and be able to access the fields from all related tables and then iterate through all rows and display the following on every row.

subcategories.subcategoryname1 subcategories.width subcategories.height subcategories.weight (which would relate to a 'Sizes.Size' field in another table. this table has sizes of 10oz, 20oz, 30oz, and 40oz)

How would I do that?

young
User
Posts: 6
Joined: 27-May-2009
# Posted on: 27-May-2009 16:52:20   

Perhaps that wasnt clear.

I have some fields from a table:

subcat.name subcat.description subcat.configurationID subcat.weightID (related table/field Weights.weightname) subcat.scaleID (related table/field Scales.scalename)

instead of displaying the weightID and scaleID, I need to show the related field name values. What I need to do with LLBLGen is similar to selecting distinct subcategory.names with an inner join to 5 other related tables.

How can I do this in LLBLGen?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 27-May-2009 17:18:28   

Now I'm confused What was wrong with using a TypedList?

young
User
Posts: 6
Joined: 27-May-2009
# Posted on: 27-May-2009 17:22:15   

I've got the answer. I modified the typed list to remove a table that I dont need on this page. The answer was quite obvious. Thanks.