Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Contributor
Posts: 10
Registered: ‎12-04-2009
Accepted Solution

Smart Part Filtering

So I am able to create a filter to Contacts of a certain type, but am unable to filter that type out and leave everyone else behind.

 

IRepository<IContact> repository = EntityFactory.GetRepository<IContact>();
            IQueryable qry = (IQueryable)repository;
            IExpressionFactory ef = qry.GetExpressionFactory();
            ICriteria criteria = qry.CreateCriteria();
            criteria.Add(ef.Eq("Account.Id", account.Id.ToString()));
            criteria.Add(ef.Eq("Type", "Patient"));
            result = criteria.List<IContact>();

 

 

I assumed it was just criteria.Add(ef.Ne("Type", Patient)); but its not working and the member descriptions in the API are not there.

Any Suggestions?

Copper Contributor
Posts: 10
Registered: ‎12-04-2009

Re: Smart Part Filtering

Well to answer my own question, it works unless the type is NULL, which it wasn't handling.

Copper Contributor
Posts: 10
Registered: ‎12-04-2009

Re: Smart Part Filtering

criteria.Add(ef.Eq("Account.Id", account.Id.ToString()));
criteria.Add(ef.Disjunction().Add(ef.IsNull("Type")).Add(ef.Ne("Type","Patient")));