Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

DataServiceQuery with a WHERE on an EXPAND field

$
0
0

I have a DataServiceQuery in Silverlight querying the ContactSet

DataServiceQuery<Contact> query = (DataServiceQuery<Contact>)LSLContext.ContactSet
.AddQueryOption("$select", "ContactId,FullName")
.AddQueryOption("$expand", "Contact_ServiceAppointments")
.Where<Contact>(s => s.new_BusinessUnitGuid == selectedCenter.BusinessUnitId);

I only want Contacts and the ServiceAppointments where the ServiceAppointment is in the future. I know the Contact_ServiceAppointments will return all the appointments for that contact, but I only want to return the appointments that are in the future.

Currently I'm getting all the contacts for the BU and looping through their appointments. This is not optimal as we have more Contacts with appointments in the past than we do in the future and it is performing unnecessary calculations in my mind.

Is this possible and if so, how?

Thanks


Viewing all articles
Browse latest Browse all 10280

Trending Articles