IPA Branch node not evaluating as expected

 2 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Jessica M
Advanced Member
Posts: 34
Advanced Member
    I have a record that I am using the DataIterator to delimit by colon and an assign to true/false when evaluating DataIterator_Output2 for "success" or "failed".  The branch then evaluates for True/False and if false (only) should write to a msgbuilder.  If true, needs to move on to the next record.  It is always writing to the msgbuilder regardless of true or false.  Can anyone review the code below from the workunit log and see where I am going wrong?

    Activity started: DataIterator4620  (Runtime Id: 223)

    Executing Data Iterator Activity DataIterator4620 ...

    iteration 2 nextPosition=20

    DataIterator4620_errorCode = 0

    DataIterator4620_informationCode = 0

    DataIterator4620_returnMessage = got record

    DataIterator4620_outputData = success

    DataIterator4620_outputData2 = success

    At end of stream.

    DataIterator4620_nextPosition = 27

    DataIterator4620_recordNumber = 2

    Activity completed: DataIterator4620

    Activity started: End-DataIterator4620  (Runtime Id: 0)

    Activity started: Assign1170  (Runtime Id: 133)

    Evaluating JavaScript expression if (DataIterator4620_outputData2=="failed") {

          FailedRecord=true

    } else if (DataIterator4620_outputData2=="success") {

          FailedRecord=false;

    }; to value false

    Variables in Process:

    Activity completed: Assign1170

    Activity started: End-DataIteratorRecord  (Runtime Id: 0)

    Activity started: Branch6900  (Runtime Id: 422)

    Branch Branch6900: Executing this branch node...

    Branch Branch6900: evaluating branch rule FailedRecord==true to node MsgBuilder3770

    Branch Branch6900: evaluating branch rule FailedRecord==false to node ResetVar

    Branch Branch6900: Next activity to be executed is ResetVar

    Activity completed: Branch6900

    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      I reported this issue to Infor the other day and it's 'working as designed'.
      If you use the JavaScript Expression to assign variable values they are treated as non-persistent. The solution is to use the regular Assign function to give the variable it's own value.
      So if you give the variable AB a value in the JavaScript Expression then you need to use a standard Assign to make AB=AB so it will be persistent.
      David Williams
      Jessica M
      Advanced Member
      Posts: 34
      Advanced Member
        I had tried that before with no luck. But I tried it again and now it is evaluating to true incorrectly.

        Activity started: DataIterator4620 (Runtime Id: 68)
        Executing Data Iterator Activity DataIterator4620 ...
        iteration 2 nextPosition=20
        DataIterator4620_errorCode = 0
        DataIterator4620_informationCode = 0
        DataIterator4620_returnMessage = got record
        DataIterator4620_outputData = success
        DataIterator4620_outputData2 = success
        At end of stream.
        DataIterator4620_nextPosition = 27
        DataIterator4620_recordNumber = 2
        Activity completed: DataIterator4620

        Activity started: End-DataIterator4620 (Runtime Id: 0)

        Activity started: Assign1170 (Runtime Id: 34)
        Evaluating JavaScript expression if (DataIterator4620_outputData2=="failed") {
        FailedRecord="true"
        } else if (DataIterator4620_outputData2=="success") {
        FailedRecord="false";
        }; to value false
        FailedRecord = false
        Variables in Process:
        FailedRecord = false

        Activity completed: Assign1170

        Activity started: End-DataIteratorRecord (Runtime Id: 0)

        Activity started: Branch6900 (Runtime Id: 34)
        Branch Branch6900: Executing this branch node...
        Branch Branch6900: evaluating branch rule FailedRecord="true" to node MsgBuilder3770
        Branch Branch6900: Next activity to be executed is MsgBuilder3770
        Activity completed: Branch6900
        Message Builder:MsgBuilder3770 Executing this activity...