Post

1 follower Follow
0
Avatar

Query to select unique records in asc/desc order

Hi,

Please help in creating query in PHP to select unique records in asc/desc order. Below is snip of code we need to select unique and sort results in ascending order

$userQuery = new stdClass(); 

//Set the name of the entity type you are querying 

$userQuery->TypeName = 'WorkItem'; 

//Select the fields you want retrieved from that entity 

$userQuery->Fields = array('C_LOB');

$request[] = new SoapVar($userQuery, SOAP_ENC_OBJECT, 'EntityQuery', ' http://clarizen.com/api/queries'); 

$executeResponse = $client->Execute(array("request" => $request));

Looking for your response.

Thanks, 

Shivani

Shivani Gupta Answered

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Shivani,

There are no duplicates in EntityQuery, as each response contains the EntityId (in this case the Workitem ID).

If you want to collect unique value of a certain field, use post processing in your code for it. 

 

If you want to sort the query results, add the Orders property to the query ($userQuery): e.g.

userQuery -> Orders => array(

array(

"FieldName" => "Name",

"Order" => "Ascending"

)

)

Ophir Kenig 0 votes
Comment actions Permalink