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] query-question for multilevel relationships between items

JensN.
14-Alexandrite

[IM] query-question for multilevel relationships between items

Hi @all,

in the attached picture you can see a structure, how items in our changemanagement could be linked via relationship fields. All items are the same itemtype, and its also always the same relationship field. Items can have different specifications, so the item at the top is in most cases a "library" and in the middle there could be "packages" and at the bottom there are "modules".

The following relationships are possible:

library -> package

library -> module

package -> package

package -> module

So how we can build a query which returns all libraries, which have a relationship (direct or not) to modules with a certain state? All what i found is the possibilty to filter over direct relationships to the next level in this structure, but not over 3 or 4 level. And also i didnt see a way to do this with subqueries.

In a pseudo-query i would say:

Give me all libraries (which have modules in state A) or (which have packages which have modules in state A) or (which have packages which have packages (which have modules in State A))

I know that reports could give us multilevel relationship filter, but thats not what we need...

I really would appreciate any hint...

thanks, Jens

structure.png

ACCEPTED SOLUTION

Accepted Solutions
mrump
16-Pearl
(To:JensN.)

Hi Jens,

There is already an RFC (we got attached to it in Oct. 2010 )

Reported to R&D as enhancement RFC 145864 via CS88090

View solution in original post

6 REPLIES 6
mrump
16-Pearl
(To:JensN.)

Hi Jens,

unfortunately this cannot be solved by a query.

Queries are only able to selected items that match a "filter" based on their first level of relationship (up or down)

What you describe would mean to JOIN the result of several queries. This cannot be done using sub-queries.

The only way to solve this is a report.

HTH Matthias

JensN.
14-Alexandrite
(To:mrump)

Hi Matthias,

i suspected this already

But i got help from our PTC Technical Consultant. He gave me a hint to a Qquery-function "walk". It is documented only in the ServerAdministrationGuide, not in the Workflows&Documents-Documentation and the functionality isnt available or even configurable yet in the GUI. So you have to create at least a very basic query from the cli with this command:

im createquery --queryDefinition='(walk[<relationship>] <id>)'

The <id> is holding the ID of the element where the walking-procedure should start. For later refinements you can use the GUI.

But this function has at least two limitations:

  1. This works only with one relationship field, so all items have to be related by the same relationship field
  2. You have to specify the ID of the starting element for this walk and this ID isnt changeable afterwards via GUI.

So its a first step...

kind regards, Jens

Hi Jens,

I don't mean to drive you away from the walk function, but keep in mind it is documented for use within reports, at least within the 10.6 Server Administration Guide.

The official answer to this sort of functionality is still to use reports, as Matthias pointed out.

Regards,
Kael


Kind Regards,
Kael Lizak

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

Hi Kael,

i know that this functionality is "officialy" only available in reports, but i think it's clear that there is a demand for such functionality for queries too. I think we will look if there is an already existing and matching RfC to add our company to it. Otherwise we will open a new one.

kind regards, Jens

mrump
16-Pearl
(To:JensN.)

Hi Jens,

There is already an RFC (we got attached to it in Oct. 2010 )

Reported to R&D as enhancement RFC 145864 via CS88090

Thank you for posting the RFC information, Matthias!

Jens, I have updated the KCS article (CS88090) to try to capture your statement of what is desired. If you have not already done so, please add your organization to this issue by opening a case with PTC Integrity Support to be associated with this enhancement request.

Regards,
Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
Announcements


Top Tags