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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Query getting Segments whose children/grandchildren got modified within a day

mhyang
10-Marble

Query getting Segments whose children/grandchildren got modified within a day

Greetings,

 

I'm trying to make a query ,via the client,

that will get me a list of segments whose children/grandchildren nodes got modified within a day.

 

Let's suppose I have documents like following :

  1. Parent : Requirement Document (ID : 1) 
  2. Child : Requirement (ID : 10)
  3. GrandChild : Requirement (ID : 100)


and I need a query which will get me the parent documents'  ID only, which is 1 here,

when his grand Children nodes (Id 100 here), or Children nodes (Id 10 here) got modified within 24 hours.

(This Modification should include attaching new Files & deleting Attached Files)

 

It seems a query filtered
-item.segment
-and Modified Date in the last 1 days by following Contains

 

is getting me the the parent item only when his child got modified with in a day.

 

and another one filterned

 

-item.segment

-and Modified Date in the last 1 days by following Contains

(OR)

-item.node

-and Modified Date in the last 1 days by following Contains or Contained By

 

is getting me the whole documents(segments) & requirements(nodes) when their offsprings got modified. 

 

Once again, I want the list, only consists of parents, when their offsprings got modified.

 

I hope there's a clue in another options.

 

Thanks for your help.

 

ACCEPTED SOLUTION

Accepted Solutions
awalsh
17-Peridot
(To:mhyang)

ETA: I'm sorry, I misunderstood what you were looking for. The original reply below will return all nodes in a document. What you are looking for is documents for which any node has changed.

With relationships, you can only search fields one-level deep. So by following Contains you can find documents whose children have changed in the last day, but not grandchildren. 

You could search for all nodes that have changed in the last day, then use the Document ID column to find the documents that are changed. The filter would be item.node and Modified Date in the last 1 days

 

Original Reply:

You can do this a couple different ways:

1. Use the Document ID field to search for all items in the document. 

2. Use the walkDocOrdered function - this can only be added to a query definition from CLI or API: 

    im createquery --querydefinition="(walkdocordered[document id])" --name="query name"

where document id  is the ID of the segment. 

View solution in original post

5 REPLIES 5
awalsh
17-Peridot
(To:mhyang)

ETA: I'm sorry, I misunderstood what you were looking for. The original reply below will return all nodes in a document. What you are looking for is documents for which any node has changed.

With relationships, you can only search fields one-level deep. So by following Contains you can find documents whose children have changed in the last day, but not grandchildren. 

You could search for all nodes that have changed in the last day, then use the Document ID column to find the documents that are changed. The filter would be item.node and Modified Date in the last 1 days

 

Original Reply:

You can do this a couple different ways:

1. Use the Document ID field to search for all items in the document. 

2. Use the walkDocOrdered function - this can only be added to a query definition from CLI or API: 

    im createquery --querydefinition="(walkdocordered[document id])" --name="query name"

where document id  is the ID of the segment. 

awalsh
17-Peridot
(To:awalsh)

Using Document ID will include the document itself. Using the walkDocOrder does not include the document. 

mhyang
10-Marble
(To:awalsh)

This supposed to be posted @awalsh's reply, I'm sorry.

 

Original Message :

 

Thanks for the reply.
In fact, it was items for 7 days which should be taken,

though I've tested'em with 1 day query.

And 7 days query returned  me "Timed out" error,

since the query spend too much resources.

This happened not just with GUI Client but with API, CLI as well.

 

Anyway , your reply always help me a lot, @awalsh. Thank you so much.

 

 

 

mrump
16-Pearl
(To:mhyang)

IMHO this cannot be done with a query alone.

 

To solve a similar problem I added a new field to the segment type called "Modified Content Date".

It is a computed field that represents the latest revision date of all nodes contained by the segment.

 

Field: Modified Content Date
Description:
        The most recent Date of a change to the documents content items.  (read-only)
Type: date
Default Value: none
Show Date Time: true
Minimum Value: none
Maximum Value: none
Computation: aggregate(ByDocument(true,true),max("Revision Date"))
Store To History Frequency: never
Computation Mode: Dynamic
Last evaluation time: Never
Allow Computation Updates on Version: yes
Relevance Rule: none
Editability Rule: (false)

 

Having this field it is now easy to find segments whose content changed e.g. last week

Query Name: Segments changed last week
Query Definition: ((field["Modified Content Date"] in the last 7 days) and (item.segment) and (item.live))

 

 

HTH

 

Matthias

mhyang
10-Marble
(To:mrump)

Thank you for the great tips, @mrump.

I think this should work, 

I guess I could try this after talking to the system manager in charge.

I appreciate for the reply again.

Announcements


Top Tags