title: How can i use variable/function in structured query using Query Marklogic processor in Apache NiFi?
body: <p>I want to query marklogic for the documents which have been updated in last 3 minutes in a collection.</p>
  
  <p>I have tried to write a structured query for the requirement but its accepting only hard-coded value for dateTime and not fn:current-dateTime() function. Below is what i tried.</p>
  
  <pre><code>&lt;query xmlns="http://marklogic.com/appservices/search"&gt;
      &lt;and-query&gt;
           &lt;collection-query&gt;
               &lt;uri&gt;live&lt;/uri&gt;
           &lt;/collection-query&gt;
           &lt;range-query type="xs:dateTime"&gt;
               &lt;element ns="" name="created-on"/&gt;
               &lt;value&gt;2019-06-10T10:36:14.002101Z&lt;/value&gt;
               &lt;range-operator&gt;GT&lt;/range-operator&gt;
           &lt;/range-query&gt;
      &lt;/and-query&gt;
  &lt;/query&gt;
  </code></pre>
  
  <p>I expect something like this -</p>
  
  <pre><code>&lt;query xmlns="http://marklogic.com/appservices/search"&gt;
      &lt;and-query&gt;
           &lt;collection-query&gt;
               &lt;uri&gt;live&lt;/uri&gt;
           &lt;/collection-query&gt;
           &lt;range-query type="xs:dateTime"&gt;
               &lt;element ns="" name="created-on"/&gt;
               &lt;value&gt;{fn:current-dateTime() - xs:dayTimeDuration("PT3M")}&lt;/value&gt;
               &lt;range-operator&gt;GT&lt;/range-operator&gt;
           &lt;/range-query&gt;
      &lt;/and-query&gt;
  &lt;/query&gt;
  </code></pre>