<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What is the name of the input variable which contains the documents for an operation? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319487#M6488</link>
    <description>&lt;P&gt;I want to use the result from &lt;CODE&gt;Document.GetChildren&lt;/CODE&gt; to calculate a dynamic folder name.
My idea is that MVEL provide the length of an array via the object method size.&lt;/P&gt;
&lt;P&gt;The problem is that I cannot find the right variable which contain the output documents.
I know that an operation can return a list of documents or a reference to a list of documents.
Nevertheless I don't find the correct variable name ;(&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0"?&amp;gt;
  &amp;lt;component name="org.nuxeo.dev.cookbook.example.pap.process-request.chains"&amp;gt;

    &amp;lt;extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains"&amp;gt;

      &amp;lt;chain id="CreateDevCookbookExamplePapProcessRequest"&amp;gt;
        &amp;lt;!--
          Input: Called from the folder with all requests
          Calculate a name for the new folder
          Create folder with title
          Create customer_form
          Open customer form
        --&amp;gt;
        &amp;lt;!-- get the folder as input --&amp;gt;
        &amp;lt;operation id="Seam.AddErrorMessage"&amp;gt;
          &amp;lt;param type="string" name="message"&amp;gt;Cannot load the folder with the requests.&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;!-- usually unnecessary --&amp;gt;
        &amp;lt;operation id="Context.FetchDocument"&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;!-- determine number of children --&amp;gt;
        &amp;lt;operation id="Seam.AddErrorMessage"&amp;gt;
          &amp;lt;param type="string" name="message"&amp;gt;Cannot calculate the name of the new file.&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;operation id="Context.SetInputAsVar"&amp;gt;
          &amp;lt;param type="string" name="name"&amp;gt;requests&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
       &amp;lt;operation id="Document.GetChildren"&amp;gt;
       &amp;lt;/operation&amp;gt;
       &amp;lt;operation id="Context.SetVar"&amp;gt;
         &amp;lt;param type="string" name="name"&amp;gt;form_name&amp;lt;/param&amp;gt;
         &amp;lt;!--
           here  I want to calculate a dynamic new file name
           BUT:  I cannot access the document list from GetChildren.
           BUT:  It looks like all variable names are unknown.
           MVEL: documents.size (should be the length of the list)
         --&amp;gt;
         &amp;lt;param type="object" name="value"&amp;gt;expr:@{Documents.size}&amp;lt;/param&amp;gt;
       &amp;lt;/operation&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The error messages always look like this one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Caused by: [Error: could not access: Documents; in class: null]
[Near : {... Unknown ....}]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The example is from the tutorial which I prepare for the Dev Cookbook.&lt;/P&gt;</description>
    <pubDate>Sun, 13 May 2012 22:39:02 GMT</pubDate>
    <dc:creator>Michael_Bell</dc:creator>
    <dc:date>2012-05-13T22:39:02Z</dc:date>
    <item>
      <title>What is the name of the input variable which contains the documents for an operation?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319487#M6488</link>
      <description>&lt;P&gt;I want to use the result from &lt;CODE&gt;Document.GetChildren&lt;/CODE&gt; to calculate a dynamic folder name.
My idea is that MVEL provide the length of an array via the object method size.&lt;/P&gt;
&lt;P&gt;The problem is that I cannot find the right variable which contain the output documents.
I know that an operation can return a list of documents or a reference to a list of documents.
Nevertheless I don't find the correct variable name ;(&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0"?&amp;gt;
  &amp;lt;component name="org.nuxeo.dev.cookbook.example.pap.process-request.chains"&amp;gt;

    &amp;lt;extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains"&amp;gt;

      &amp;lt;chain id="CreateDevCookbookExamplePapProcessRequest"&amp;gt;
        &amp;lt;!--
          Input: Called from the folder with all requests
          Calculate a name for the new folder
          Create folder with title
          Create customer_form
          Open customer form
        --&amp;gt;
        &amp;lt;!-- get the folder as input --&amp;gt;
        &amp;lt;operation id="Seam.AddErrorMessage"&amp;gt;
          &amp;lt;param type="string" name="message"&amp;gt;Cannot load the folder with the requests.&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;!-- usually unnecessary --&amp;gt;
        &amp;lt;operation id="Context.FetchDocument"&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;!-- determine number of children --&amp;gt;
        &amp;lt;operation id="Seam.AddErrorMessage"&amp;gt;
          &amp;lt;param type="string" name="message"&amp;gt;Cannot calculate the name of the new file.&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
        &amp;lt;operation id="Context.SetInputAsVar"&amp;gt;
          &amp;lt;param type="string" name="name"&amp;gt;requests&amp;lt;/param&amp;gt;
        &amp;lt;/operation&amp;gt;
       &amp;lt;operation id="Document.GetChildren"&amp;gt;
       &amp;lt;/operation&amp;gt;
       &amp;lt;operation id="Context.SetVar"&amp;gt;
         &amp;lt;param type="string" name="name"&amp;gt;form_name&amp;lt;/param&amp;gt;
         &amp;lt;!--
           here  I want to calculate a dynamic new file name
           BUT:  I cannot access the document list from GetChildren.
           BUT:  It looks like all variable names are unknown.
           MVEL: documents.size (should be the length of the list)
         --&amp;gt;
         &amp;lt;param type="object" name="value"&amp;gt;expr:@{Documents.size}&amp;lt;/param&amp;gt;
       &amp;lt;/operation&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The error messages always look like this one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Caused by: [Error: could not access: Documents; in class: null]
[Near : {... Unknown ....}]
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The example is from the tutorial which I prepare for the Dev Cookbook.&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2012 22:39:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319487#M6488</guid>
      <dc:creator>Michael_Bell</dc:creator>
      <dc:date>2012-05-13T22:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: What is the name of the input variable which contains the documents for an operation?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319488#M6489</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;
&lt;P&gt;I manage to do it by first setting the input of the getChildren operation as a context variable. Here's a screenshot of my example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://connect.hyland.com/upfiles/studio_2.png"&gt;&lt;IMG src="https://connect.hyland.com/upfiles/studio_2.png" width="300" height="100%" /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2012 11:48:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319488#M6489</guid>
      <dc:creator>Laurent_Doguin</dc:creator>
      <dc:date>2012-05-14T11:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: What is the name of the input variable which contains the documents for an operation?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319489#M6490</link>
      <description>&lt;P&gt;Hi Laurent,&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2012 12:40:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/what-is-the-name-of-the-input-variable-which-contains-the/m-p/319489#M6490</guid>
      <dc:creator>Michael_Bell</dc:creator>
      <dc:date>2012-05-14T12:40:15Z</dc:date>
    </item>
  </channel>
</rss>

