Hello,
I am new to LLBL Pro but have a large project that uses it, I am really struggling with actions that in volve m:n relationships. We are using self service and it seems like I need to create views in the db to get what I want is this true?
I am including a sample of sql that joins 6 tables and I need to get a Collection of data set back to the page and be able to manipulate it from other user controls, I get close but can seem to get the joined fields in my grid view.
Here is the sql:
SELECT
p.ProductId,p.Name,p.sku,ps.Name,s.Name season,pt.Name as ptype,pc.name as category
FROM
Product p,ProductSeries ps,ProductSeriesSeasons pss,Season s,ProductType pt,ProductCategory pc
WHERE
p.ProductTypeId = pt.ProductTypeId and
pt.ProductCategoryId = pc.ProductCategoryID and
p.ProductSeriesId = ps.ProductSeriesId and
p.ProductSeriesId = ps.ProductSeriesId and
ps.ProductSeriesId = pss.ProductSeriesId and pss.seasonid = s.seasonId
AND
pc.Name ='Bottoms'
AND
ps.Name = 'Peloton'
Here is how I am trying to get this back with the objects
ProductCollection getProducts = new ProductCollection();
RelationCollection relationsToUse = new RelationCollection();
relationsToUse.Add(ProductEntity.Relations.ProductTypeEntityUsingProductTypeId);
relationsToUse.Add(ProductTypeEntity.Relations.ProductCategoryEntityUsingProductCategoryId);
IncludeFieldsList includeFields = new IncludeFieldsList();
includeFields.Add(ProductFields.ProductId);
includeFields.Add(ProductFields.Name);
includeFields.Add(ProductFields.Cost);
includeFields.Add(ProductFields.Msrp);
includeFields.Add(ProductTypeFields.Name);
includeFields.Add(ProductCategoryFields.Name);
IPredicateExpression selectFilter = new PredicateExpression();
selectFilter.Add(ProductCategoryFields.Name == "Tops");
getProducts.GetMulti(selectFilter, 0, null, relationsToUse,null,includeFields,0,0);
gvProducts.DataSource = getProducts;
gvProducts.DataBind();
As you can seen I need to get a list of products and product info from several tables into my grid.
Thank