2 Replies Latest reply: Dec 30, 2012 3:47 PM by user1764116 RSS

    Problem by inserting values into an Array

      Hi All,

      I am newbe and i am stack.
      I have a human tasks(Iniziato Pattern) that contains 4 input fields(all strings).
      I have a complex datatype called Test, that is defined as 2 string fileds(Description and Result) and one number filed(test number).
      I have an array of Test,insiemiDiTest.
      What i want to do is to create 2 Tests object from the input fields and insert them into the array insiemiDiTest, in order to be able later to use the loop for inserting them into the DB.
      suppose that the user insert the following information into the input filed:
      input1 descrTest1
      input2 resultTest1
      input3 descrTest2
      input4 resultTest2
      I want to have in the process the variable insiemiDiTest to have length 2 and the following content:

      If i use the data association and i link
      input1 with insiemiDiTest[1].description
      input2 with insiemiDiTest[1].result
      number('1') with insiemiDiTest[1].testNumber
      I get an error saying that the insiemiDiTest[1].description is empty and can not be copied.

      Unfortunaly i can not use directly the array in the User Task, becuase later on i have to use the conversation when calling process and we found i limitation.
      I can find any indication about how to do it.
      I am approccing in the right way or i am completly wrong?
      Thanks in advance and merry Xmas.
        • 1. Re: Problem by inserting values into an Array
          Because your input is coming from a few strings and not an array, you might want to just add a Script activity to your process and set your target XSD's array using XML.

          To do this, you'd add a Script activity -> click 'Data Associations' -> drag the expression builder icon over your target object on the right side (not the array but the parent of the array) -> open the XPath expression box in the middle -> click 'XPath Exp' from the dropdown on the top.

          I don't know what your XSD looks like, but in the text below I've attempted to show you the XML that you'd need for this XPath expression using the values you provided.
          oraext:parseXML(concat('<example:array xmlns:example="http://www.example.org">
          Where I have "bpmn:getDataObject('...')", you'd instead insert your four string data object variables from your process.

          Hope this helps,
          • 2. Re: Problem by inserting values into an Array
            HI Dan,

            Thanks for the informatation, you let me know samething new.
            Thanks to your code i was able to create the correct one, based on my xsd.
            I am posting it below:
            oraext:parseXML(concat('<SetOfTest xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/SetOfTest">
            <testNumber xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">1</testNumber>
            <testDescription xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">',bpmn:getDataOutput('parameter1'),'</testDescription>
            <testResult xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">',bpmn:getDataOutput('parameter2'),'</testResult>
            <testNumber xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">2</testNumber>
            <testDescription xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">',bpmn:getDataOutput('parameter3'),'</testDescription>
            <testResult xmlns="http://xmlns.oracle.com/bpm/bpmobject/Data/Test">',bpmn:getDataOutput('parameter4'),'</testResult>
            </SetOfTest> '))

            Your post was a good Xmas gift!