Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi I am struggling to get items with getItemsByCustomQuery
Please find below code,
MKSService.getItemsByCustomQuery cusQ = new getItemsByCustomQuery();
MksIntegration.MKSService.CustomQuery qry = new CustomQuery();
MKSService.Integrity_2009Client cl = new Integrity_2009Client();
string DateStr = "2014-10-29";
qry.QueryDefinition = "Modified Date = " + DateStr;
qry.Username = "XXXXXX";
qry.Password = "XXXXXX";
string[] field1 = new string[] { "id", "Summary", "Modified Date" }; //
qry.InputField = field1;
cusQ.arg0 = qry;
getItemsByCustomQueryResponse qryRes = new getItemsByCustomQueryResponse();
qryRes = cl.getItemsByCustomQuery(cusQ);
Appreciate your response
Thanks
Hello Santosh Bhosale,
You might want to look at one of the code samples in the Sample Code Knowledge Hub for Integrity. You might also want to look at the article Integrity: How to build a custom query.
Is that helpful at all?
Kind Regards,
Kael
Hi Kael,
Thanks for your reply.
I checked the links shared by you. But the sample code is for creating the new item. I want to search or get the item of particular date or between date. I am able to retrieve the data of supplied ID, but problem is with Modified Date and Created Date. I want to query the items of particular date. And second link doesn't explains anything.
Best Regards,
Santosh
Hello Santosh Bhosale,
Jim Bates comment below points you in the right direction.
Kind Regards,
Kael
The syntax for searching by date isn't quite as obvious as it could be. There are several options available, however the one that I believe that you're looking for is:
Modified Date between Oct 29, 2014 and Oct 29, 2014
You have other options such as:
Modified Date today
Modified Date yesterday
Modified Date in the last 7 days
When I have to create queries to use through the API, CLI, web service, etc, especially where the syntax isn't obvious, I create them using the GUI first, save the query, then use the CLI to view the query definition to get the proper syntax. I then use that syntax as the basis for creating a dynamic query in code.
Also, be aware of timezone differences. When using the API you may find that all date values are returned in UTC values, and require conversion.
Hey Jim,
Thanks for your inputs. Its working.