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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

IM: Quick Query for a list of IDs

JensN.
13-Aquamarine

IM: Quick Query for a list of IDs

Hi @all,

maybe this is a kind of stupid question, but i didnt find an easy solution by myself

I want to have an easy way to make a query for a list of Item-IDs. All what i've found was a querydefinition like this:

((field["ID"] = 532699) or (field["ID"] = 444543) or (field["ID"] = 321876) or ...)

In the rich client it is a pain for the users to put a list of 10 or 20 of these IDs into a query by the rule-wizard. Is there any easyer way to do this?

Thanks...

Jens

8 REPLIES 8

Hi Jens,

We had the same use-case and created 2 mechanisms for doing this. The end result is easier than creating all those filters manually through the GUI, but it takes a bit of admin work to set up.

1) Use Excel (or any spreadsheet programs) to generate the query definition as part of a CLI command for users to copy-paste.

. Our version works by transforming a column of IDs to another column of "(field["ID"] = XYZ) or ", then transforming that column into a column which appends itself to the previous cell, so the bottom of the column has a cell with "(field["ID"] = XYZ1) or (field["ID"] = XYZ2) or (field["ID"] = XYZ3) or (field["ID"] = XYZ4) or ".... Then we take that value and wrap it with (), drop any extra "or" to get a valid query-definition, and plug it into a CLI command for im createquery.

2) Create a reusable "querybuilder" item in Integrity that works as a frontend to the createquery API call.

Our item has fields for all the necessary parts of the query (query name, groups for read access, groups for modify access), a longtext field that accepts a comma separated list of IDs, and a yes/no pickfield. Changing the pickfield to yes makes the list of IDs and query name mandatory via type constraints. Saving the item with the pickfield = yes runs an event trigger which parses the various fields to construct the arguments for an im createquery API call, including building the definition by splitting the field of IDs. The trigger then executes that API call to create the query, notifies the user via an admin-only text field and clears out the other fields on the querybuilder item so that the item can be re-used.

Hope that helps,

Matt

JensN.
13-Aquamarine
(To:matt_giltaji)

Hi Matt

thanks for your answer. At least your second mechanism sounds interesting. Either we do it in this or a similar way, or we will wrote a little script or program to use it as a custom action.

regards, Jens

tdalon
4-Participant
(To:JensN.)

Hi Jens&Matt

for which precise use case do you need something like it?

Normally I use a query to get the list of ID and I can't think about a concrete example for your wish.

Many thanks

Regards, Thierry

JensN.
13-Aquamarine
(To:tdalon)

Hi Thierry,

one usecase: often a user comes with a list of IDs to his project lead or so. The project lead has then to change the state of all these items or to change some field-values. These items we cant put together with a query in an easy way, because they can be part of different projects, with different responsible persons and so on. So the best way to get all these items into one view is an ID-Query.

Yesterday i wrote a little script which is now integrated as custom action. This little utility gets a list of ID's per Copy'n'Paste and put them into a rule in an user defined query. This is good enough as a workaround, but we would like to see the possibility of putting a bunch of values (not only ID's) into a query directly in the rich client.

kind regards, Jens

KaelLizak
14-Alexandrite
(To:JensN.)

For anyone who runs into this issue and would like a core product fix, please contact PTC Integrity Support to be added to RFC 116436.


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
JensN.
13-Aquamarine
(To:KaelLizak)

Thanks Michael, i've added our company to this rfc.

regards, Jens

mrump
14-Alexandrite
(To:JensN.)

Hi Jens,

as far as I understand your Use Case, you do not need a Query at all.

A Query based on fixed Item-IDs is nothing more than a "List".

As we do have very similar use case's with "lists of Issues to be fixed", I choose not to bother with queries but creates a "generic list item". It is more or less a copy of the "workitem" concept from current solutions templates.

The generic list item is simple item type that only contains a single relationship field "list content" which can be filled by almost any type in my config.

The "list content" is filled e.g. by drag&drop gestures.

Each user can create his own lists and/or them with others.

The advantage ( besides the omitted need of handling query definitions ) is

- you have the automatic history for changes in the "list content" (of course you can set editability rules as well)

- you can easily have metrics on the "list content" - (including trend charts)

- for your use case you could define a "due date" and have trigger check whether all contents meet the

required state.

- Any report you already have can be reused to "print" the "list-content" (even historical ones)

- Using the relationship view you can have the same batch edit functions as from a query view.

As you see, there a plenty possibilities to implement day-to-day use cases like

- (status) - reports

- todo - lists

- .....

HTH Matthias

JensN.
13-Aquamarine
(To:mrump)

Hi Matthias,

thanks, this sounds interesting too. I will try a little bit and then will have a look of pros and cons about an ID-List-Item or an Custom-Action-querybuilder...

kind regards, Jens

Top Tags