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

How do I create a dynamic query?

crunge
3-Visitor

How do I create a dynamic query?

In other tools that I have used, I could create a prompt to the user to provide input for the query. For queries, I have found that there is a project filter option that will do what I need in some cases. However, if I try to create a chart based off of that query, I have not found a way to allow the user to filter by their project. Furthermore, if I want to filter the query results based on another field besides the project field based on user input, I have not found a good way to do this.

Any help would be appreciated.

5 REPLIES 5

Unfortunately, I don't believe the "dynamic query" or "dynamic chart" functionality you are looking for exists.

As a workaround, you could use custom jsp pages to accept some input and then run queries based on that input, but that can be very time consuming to build and maintain.

There is another workaround if you are using the more recent versions of Integrity (I think 2009 SP7 and higher). There is a "show items containing" field in the query results screen which can be used to apply additional filters on the query results based on user input. This has been extremely useful at my company.

To a PTC rep, do you know if there is an existing RFC for dynamic query/chart/report parameters?

Matt

mrump
14-Alexandrite
(To:crunge)

Hi Christina,

I assume your use case is:

- create a chart/query/report once and view it's results filtered for different projects, e.g. to be able to compare different projects

This can be done using dashboards. In a dashboard you can enable the user to interactively change the "filter project" that is automatically processed for all query, charts and reports in the dashboard.

This works fine, but unfortunately the filter can only be applied for the project field.

If you have a Product-Portfolio-Project triangle, you cannot specify for example the Product as a Filter for the dashboard.

HTH Matthias

Note: During dashboard design you can even specify whether the automatic filtering is applied or not for each chart/report individually.

crunge
3-Visitor
(To:mrump)

Thanks. I think the dashboard filter will do what I'm looking for.

dany_michail
4-Participant
(To:crunge)

Hello Christina, for you it is maybe too late but maybe for other members from our community it will be helpful.

You can create a simple batch file as a “Custom Action” for extending the definition of a base query registered on the server in two ways:

a) 1) Dynamic

Read from console input (you can use SET /P in win cmd interpreter) extension of your base query, add filter condition and execute new query with “im issues” CLI command

b) 2) “Static”

Define a kind of configuration file for your batch and map filter conditions to user friendly names. Load this configuration file into batch and offer a kind of “extension filter list” to the end user (like an old MS DOS menu).User’s selection will extend base query with filter expression associated in configuration file. In this case, user needs to maintain filter expressions.

Both ways can be implemented/extended in a GUI app also (VB, Java + SWT, Python + wxWidget, ...)

Here is how I do it in 10.4. This works with any filter you can come up with that will work in the normal query engine. If you are unfamiliar with the syntax, just make a query using their query builder then go to the CLI and run this command: im viewquery --hostname=blahblah --port=blahblah --user=me "MyQuery"

FYI, the function encodeURIComponent() is already included in javascript and works in most browsers.

var query = "((subquery[All Requirements Targeted For Release]) and " +

"(relationship[ID] forwards using [Requirements Implemented In] = " + this.Id + "))";

var hyperlink = "integrity://" + host.name + ":" + host.port + "/im/issues?queryDefinition=" + encodeURIComponent(query);

if you use this hyperlink in the Integrity Client you have to encode it. If you use the link in an IE browser you have to double encode it: encodeURIComponent(encodeURIComponent(query)); Other browsers do not need to be double encoded.

Top Tags