fiogf49gjkf0d Originally posted by Mike LaSpina
If you have a relationship defined int he ORM, it should not matter. You can reference related properties in the grid. For example, ContactAccount.Contact.FirstName.
|
|
It's not finding the field in the GetByMethod data source for the filtered grid (it is finding it for the GetByProperty data source).
ACCOUNT -->OppAssocAccounts gives us all of the OppAssocAccount table entries.
-->Opportunity gives us the Opportunity for the OppAssocAccount table entry.
My GetByProperty data source uses Opportunity.Description, Opportunity.SalesPotential, etc. and has no issues in retrieving the related Account's Opportunities data nor sorting by the column names.
I want to filter the grid by the opportunity Product Line value, getbyMethod Business Rule:
The CreateAlias is probably the culprit:
<Code> //Build Query for basic Account specific data. IRepository<Sage.Entity.Interfaces.IOppAssocAccount> repository = EntityFactory.GetRepository<Sage.Entity.Interfaces.IOppAssocAccount>(); IQueryable qry = (IQueryable)repository; IExpressionFactory ef = qry.GetExpressionFactory(); Sage.Platform.Repository.ICriteria criteria = qry.CreateCriteria(); criteria.CreateAlias("Opportunity","Opportunity"); if (ProductLine.ToString() == "") { ProductLine = "ALL"; } if (ProductLine.ToUpper() == "ALL") { ProductLine = "ALL"; } if (ProductLine.ToUpper() != "ALL") { criteria.Add( ef.Eq("Opportunity.ProductLine", ProductLine) ); } criteria.Add( ef.Eq("Account.Id", account.Id.ToString()) ) ; result = criteria.List<Sage.Entity.Interfaces.IOppAssocAccount>();
</Code>
Any Hints?!
AND YES, criteria.AddOrder is Additive and works.....just did a 5 tier sort! Awesome and thanks Mike! |