04-01-2014 10:30 AM
Hi, I want to modify a property of a document and of all its descendants.
I have builded an automation chain ("myChain) to make it recursively. This chain is called by an user action.
It does work only for a document without child...
Here is the chain :
Fetch > Context Document(s)
Document > Update Property -value : myValue -xpath : mySchema:myProperty -saved : checked
Document > Get Children
Execution Context > Set Context Variable From Input -name : myList
Execution Flow > Run For Each -id : myChain -list : myList -isolate : checked -item : item
Can somebody help me ?
04-06-2014 11:00 AM
To get all the documents in a container (and sub-sub-sub-documents), you can use the Query
operation to ftech all documents whose path
starts with the path of the current folder:
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Then, you have a list of documents:
Document > Update propertty
or Document > Update Properties
. The operation will be applyed for each document in the list Execution Flow > Run Document Chain
So, your chain could be...
Fetch > Context Document
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
... where all documents will have the "myValue" value in the mySchema:myProperty
field.
Or you can use a subchain...
Fetch > Context Document
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Execution Flow > Run Document Chain
id: TheSubChain
isolate: (depends on your needs)
parameters: (none)
...with TheSubChain
doing "something". Here, I am just logging an information:
Fetch > Context Document
Notification > Log
level: warn
message: Current doc is doc id @{Document.id}, path: @{Document.path}
IMPORTANT
The query
here gets all and every Nuxeo document, which includes containers (Folder
, typically), deleted (in the trash), hidden, etc. So, maybe you will want to tune the query. For example, to ignore Folder
and usually hidden documents:
SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}' AND ecm:mixinType != 'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'deleted' AND ecm:primaryType != 'Folder'
Thibaud
04-02-2014 03:06 AM
Here is the error message I obtain
04-06-2014 11:00 AM
To get all the documents in a container (and sub-sub-sub-documents), you can use the Query
operation to ftech all documents whose path
starts with the path of the current folder:
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Then, you have a list of documents:
Document > Update propertty
or Document > Update Properties
. The operation will be applyed for each document in the list Execution Flow > Run Document Chain
So, your chain could be...
Fetch > Context Document
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
... where all documents will have the "myValue" value in the mySchema:myProperty
field.
Or you can use a subchain...
Fetch > Context Document
Document > Update Property
value : myValue
xpath : mySchema:myProperty
saved : checked
Fetch > Query
query: SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}'
language: NXQL
Execution Flow > Run Document Chain
id: TheSubChain
isolate: (depends on your needs)
parameters: (none)
...with TheSubChain
doing "something". Here, I am just logging an information:
Fetch > Context Document
Notification > Log
level: warn
message: Current doc is doc id @{Document.id}, path: @{Document.path}
IMPORTANT
The query
here gets all and every Nuxeo document, which includes containers (Folder
, typically), deleted (in the trash), hidden, etc. So, maybe you will want to tune the query. For example, to ignore Folder
and usually hidden documents:
SELECT * FROM Document WHERE dcm:path STARTSWITH '@{Document.path}' AND ecm:mixinType != 'HiddenInNavigation' AND ecm:isCheckedInVersion = 0 AND ecm:currentLifeCycleState != 'deleted' AND ecm:primaryType != 'Folder'
Thibaud
04-08-2014 09:50 AM
Thank you very much !
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.