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
New Member
Posts: 20
Registered: ‎08-23-2010
Accepted Solution

SData related entity "include" in Query

I’m using the SData Client Library and am trying to use the ‘Include’ parameter for a query. So, for example, I want to return the Address fields from Accounts. If I were reading a single record, I would do something like this:

 

SDataSingleResourceRequest sr = new SDataSingleResourceRequest(OrigSDataSvc);

sr.ResourceKind = “accounts”;

sr.ResourceSelector = ID;

sr.Include = “address”;

entry = sr.Read();

 

However, I’m trying to return the address as a group result of a query using the SDataResourceCollectionRequest Object.

 

This object does not have an “Include” parameter, even though it looks like it should be possible according to the specs here: http://interop.sage.com/daisy/sdata/Queries/ControllingThePayload.html

 

So, question is – can I use “Include” on a query or is it only possible with a Single request? If not possible, would I then have to iterate each result in a query result with an additional Single request?

 

Highlighted
Copper Super Contributor
Posts: 23
Registered: ‎08-17-2009

Re: SData related entity "include" in Query

With the SDataResourceCollectionRequest class, the include is a query parameter. Here's an example:

var service = new SDataService("http://localhost/sdata/slx/system/-/", "admin", "");
var request = new SDataResourceCollectionRequest(service)
{
ResourceKind = "libraryDirectories",
QueryValues =
{
{"include", "documents"},
{"orderBy", "directoryName"}
}
};
Highlighted
New Member
Posts: 20
Registered: ‎08-23-2010

Re: SData related entity "include" in Query

Thanks so much, just what I was looking for!