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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Query for all contents of a specific segment/document

amund
12-Amethyst

Query for all contents of a specific segment/document

Hello All,

 

I am trying to create a query using the client which should give me a list of all contents (all children and grandchildren) of a certain segment/document as well as the children and grandchildren of included subdocuments.

 

Example: Main document (ID123456) is structured as follows

1 Heading

1.1 Description

1.2 Requirement

1.3 Subdocument 1

1.3.1 Heading (SubDoc1)

1.3.2 Requirement (SubDoc1)

2 Subdocument 2

2.1 Heading (SubDoc2)

2.1.1 Requirement (SubDoc2)

2.2 Heading

2.2.1 Heading

2.2.1.1 Subdocument 3

2.2.1.1.1 Requirement (SubDoc3)

2.2.1.1.2 Requirement (SubDoc3)

 

The query should now list all children/grandchildren (also the children/grandchildren of the included subdocuments) of document ID123456.


Children and grandchildren of other documents that are not included in this document or nodes that have been deleted should not be listed.

 

Can anyone here help me?

How do I have to build the query filter so that the correct list is displayed?

 

Many thanks in advance for your help!

3 REPLIES 3
LLawton
16-Pearl
(To:amund)

This cannot be done with a query that goes through relationships.

That's because a query can select only related items one level down (you cannot select a related item of a related item and so on). In your example, starting from the document item you will get only 1st-level related items "1" and "2".

I've been struggling with this for many years, but I had no strong reason to find a workaround. For my purposes, I include a hyperlink on my item presentations that runs a report. In the report, you can go many (for me 9) levels down. Of course, it's a custom recipe.

I may have to fix that now and the state of my thinking is to add a field that will store the structure so you can query and order with it. The field would be populated by trigger. I don't like it, mainly because it pollutes the history of all related items, plus you have to deal with moves/deletes, so it's not such an easy problem.

If only we had access to "Section", we might be able to use a calculated field, but that cannot be done at present either (I'm still on 11.2). Another idea would be to get access to the output or "View Relationships". So far, no luck.

If anyone has suggestions, please comment.

amund
12-Amethyst
(To:LLawton)

@LLawton 

Thank you very much for your feedback!

At least now I know that I am not the only one with this problem.

amund
12-Amethyst
(To:amund)

Would it be possible to solve the problem with several queries?
Example: A first query is created, which queries the contents of the document and thus the first level (which is not a problem). Then it would output "1" and "2" as result.
Then a second query is created. I would now create basically the same query, but instead of retrieving the contents of the document ID, the contents of the results of the first query should be retrieved (thus the second level; results would be "1.1", "1.2", "1.3", etc.).
Is it possible to create a second query based on the results of the first one?
If this would be possible, you could continue to do so until all levels are covered and finally output all results in one query, right?

Announcements


Top Tags