title: get index of a value from list/array in dataweave
body: <p>I have an array in dataweave lets say</p>
  
  <pre><code>[value1,value2,value3,value4] 
  </code></pre>
  
  <p>I would like to get the index of my value in array. Suppose if I want to know at which index position 'value2' is present, it should return 2.</p>
  
  <pre><code>**code I tried:**
  
  %dw 1.0
  %output application/xml
  %var myArray =[] as :array
  ---
  {
   root: using (myArray = payload.values.*value distinctBy $) {
   (payload.values.*value map{
      position: "needs logic to get position of current value in the myArray created"
    })
  }
  
  
  **input:**
  &lt;values&gt;
    &lt;value&gt;value1&lt;/value&gt;
    &lt;value&gt;value2&lt;/value&gt;
    &lt;value&gt;value3&lt;/value&gt;
    &lt;value&gt;value4&lt;/value&gt;
    &lt;value&gt;value1&lt;/value&gt;
    &lt;value&gt;value3&lt;/value&gt;
  &lt;/values&gt;
  
  
  expected output:
    &lt;root&gt;
      &lt;position&gt;1&lt;position&gt;
      &lt;position&gt;2&lt;position&gt;
      &lt;position&gt;3&lt;position&gt;
      &lt;position&gt;4&lt;position&gt;
      &lt;position&gt;1&lt;position&gt;
      &lt;position&gt;3&lt;position&gt;
    &lt;root&gt;
  </code></pre>