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
Tuned Listener
Posts: 16
Registered: ‎06-25-2013

SData - Complex query examples?

I am creating an application in c# to return data using SData.

 

I have already created the foundation of the program and I am able to connect and return data, but I would like to run more complex queries, and I am wondering if that is possible and if there are any examples out there, or if someone could provide some examples.

 

Basically I would like to give the user the option to create very granular conditions on their queries.

 

I would like to search for a KB articles and allow the user to search for Title, Description, Tags, and Content.

 

Each of these fields could have granular conditions like you might find when creating conditions when adding a new group.

 

For example:

Title needs to contain "ABC" and "XYZ", so it would only return a result if both those conditions are met.

Title could contain "ABC" or "XYZ", so it would return and articles with "ABC" or "XYZ"

Title could contain "ABC" or "XYZ" but NOT "DEF"

 

Right now I am using an example from "customerfx" 

// This part is optional (without it we'd be getting ALL contacts). 
// This is our where clause, or condition of which contacts we want.
// In this example we want all contacts whose last name starts with
// the value 'Ab'. We need to use the exact property name as defined
// in the entity (case-sensitive).
req.QueryValues.Add("where", "LastName like 'Ab%'");

 

In this example can you turn that into a more complex query like I am looking for?

 

Or would I be better off caching all the articles locally, updating whenever there are new ones, and leveraging the power of c# to parse the data I want?

 

Thanks! Smiley Wink

Highlighted
Gold Super Contributor
Posts: 3,087
Registered: ‎03-19-2009

Re: SData - Complex query examples?

Here's some links to SData specs you will find useful:

      http://interop.sage.com/daisy/sdata/Queries.html

http://sdata.sage.com/

--
RJ Ledger - rjledger@rjlSystems.net +1 603.369.3047 x101

".. Innovators in Mobility - Experts in Workflow Automation..."
http://www.rjlSystems.net - blog: www.rjlSystems.net/blog.html
Highlighted
Employee
Posts: 27
Registered: ‎08-06-2009

Re: SData - Complex query examples?

Check out section 2.12 of the SData specification. It contains a few where condition examples including one with a logical conjunction (AND).