cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

what is the IM query to display results with conditions having Owners and date ranges ?

Gangadhar
4-Participant

what is the IM query to display results with conditions having Owners and date ranges ?

We're preparing an IM Query which displays results having 2 conditions. Condition 1 -> where owner="Username" and Condition 2 -> date range in a month. Is there some im command which supports to give both the conditions and to retreive the results from PTC Integrity.

 

Can some one please help us if you have some idea. Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions
awalsh
17-Peridot
(To:Gangadhar)

For the date ranges, do you mean a particular date field is within these ranges? Or that the item has been modified or that the item has been created in the date range? Any of these can be done; the query will differ in each case.

 

 

On the CLI, you can use the im createquery command to create a query, or you can use the im issues command with the queryDefinition option to view items matching the filter without creating a query.

 

For example, the following command will create a query that returns all items changed in March 2018 that have the Owner field set to "awalsh":

im createquery --name="AW Created in March" --queryDefinition="((histdate.anyField was changed between 03/01/2018 and 03/31/2018) and (field[Owner] = awalsh))"

The following command will return all items created in March 2018 that have Owner field set to awalsh:

im issues --queryDefinition="((field[\"Created Date\"] between 03/01/2018 and 03/31/2018) and (field[Owner] = awalsh))"

If you are querying a different date field or different user field, then use that field name instead of "Created Date".  You can use the same --queryDefinition value for im issues if you don't want to create a query.  

 

For other date values or filters, I find it easiest to create a query in the GUI and then look at the query using im viewquery queryname to find the exact syntax for the query filters. 

 

In the GUI, to query on changed items, after opening the Edit or Create query dialog, select Add Filter, then History (by Date) for the type of filter and -Any Field- for the field.  You can give a date range or a relative date (e.g. last month). For querying on field values, use the Fields filter type.

 

In the Web, click on the + at the bottom of the Edit/Create Query dialog and select Add a History Field > Add a History Filter by Date. For querying on field values, use Add a Field Filter.

 

More information on creating queries and the filters available can be found in the Online Help:

Creating a Query in GUI 

Creating a Query in the Web Interface

im createquery  

im issues

 

View solution in original post

1 REPLY 1
awalsh
17-Peridot
(To:Gangadhar)

For the date ranges, do you mean a particular date field is within these ranges? Or that the item has been modified or that the item has been created in the date range? Any of these can be done; the query will differ in each case.

 

 

On the CLI, you can use the im createquery command to create a query, or you can use the im issues command with the queryDefinition option to view items matching the filter without creating a query.

 

For example, the following command will create a query that returns all items changed in March 2018 that have the Owner field set to "awalsh":

im createquery --name="AW Created in March" --queryDefinition="((histdate.anyField was changed between 03/01/2018 and 03/31/2018) and (field[Owner] = awalsh))"

The following command will return all items created in March 2018 that have Owner field set to awalsh:

im issues --queryDefinition="((field[\"Created Date\"] between 03/01/2018 and 03/31/2018) and (field[Owner] = awalsh))"

If you are querying a different date field or different user field, then use that field name instead of "Created Date".  You can use the same --queryDefinition value for im issues if you don't want to create a query.  

 

For other date values or filters, I find it easiest to create a query in the GUI and then look at the query using im viewquery queryname to find the exact syntax for the query filters. 

 

In the GUI, to query on changed items, after opening the Edit or Create query dialog, select Add Filter, then History (by Date) for the type of filter and -Any Field- for the field.  You can give a date range or a relative date (e.g. last month). For querying on field values, use the Fields filter type.

 

In the Web, click on the + at the bottom of the Edit/Create Query dialog and select Add a History Field > Add a History Filter by Date. For querying on field values, use Add a Field Filter.

 

More information on creating queries and the filters available can be found in the Online Help:

Creating a Query in GUI 

Creating a Query in the Web Interface

im createquery  

im issues

 

Top Tags