7/1/2025 2:31:35 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Filtering Types of Contacts under an Account
Posted: 09 Feb 10 9:05 AM
|
Under the Contact tab of an Account, I'm trying to create filters to show only certan types of contacts.
I was able to create a tab that Listed only contacts with type Patient: criteria.Add(ef.Eq("Account.Id", account.Id.ToString())); criteria.Add(ef.Eq("Type","Patient"));
On my other tab, when trying to filter OUT patients to show everyone else, If the contact type is NULL it won't show at all criteria.Add(ef.Eq("Account.Id", account.Id.ToString())); criteria.Add(ef.Ne("Type","Patient"));
I tried adding: criteria.Add(ef.Disjunction().Add(ef.IsNull("Type"))); but i'm sure its wrong because it then gives me an empty list.
what's the correct way to add the "or" statement?
|
|
|
|
Re: Filtering Types of Contacts under an Account
Posted: 12 Feb 10 4:44 AM
|
Hope this helps, dug this out of an FAQ I had lying around:
By default, calling ICriteria.Add(IExpression) successively will combine all expressions with the AND junction. If you want to combine an arbitrary number of expressions with OR, you can use the IJunction interface, as follows:
Sage.Platform.Repository.IJunction junction;
if (weWantToAndThisExpression) { junction = ef.Conjunction(); // AND } else { junction = ef.Disjunction(); // OR }
ICriteria.Add(junction .Add(ef.Eq("Account", account)) .Add(ef.Eq("IsPrimary", true))) .List();
Looks like you might wanna try something like:
criteria.Add(ef.Eq("Account.Id", account.Id.ToString())); criteria.Add(ef.Disjunction().Add(ef.IsNull("Type")).Add(ef.Ne("Type","Patient")));
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|