Hi all,
I have an HTTP task that returns me this JSON:
{
"Results": {
"output1": {
"type": "table",
"value": {
"ColumnNames": [
"Scored Labels",
"Scored Probabilities"
],
"ColumnTypes": [
"String",
"Double"
],
"Values": [
[
"4",
"0.648628652095795"
]
]
}
}
}
}
Short Version:, I’m having trouble evaluating against values that are in an array. I can retrieve them just fine, but when I compare them like so:
${responseVar.Results.output1.value.Values.get(0).get(0) == '4' }
The expression never works. I have no problems when doing it against any value that’s not in an array. Is the syntax incorrect when I have to use the .get() functions?
======== Detailed Explanation ========
I’m storing this output as JSON in a variable and want to use it later on in my process in a next task. The way I’m using this information is I have an exclusive gateway with 2 sequence flow branches.
Logically, it should be very simple. If the following value is 4, I want it go to in one direction. If not, I want it to go to the other. This is the value I’m talking about (first element in the nested array):
"Values": [
[
"4" <--- This one,
"0.648628652095795"
]
]
I retrieve the value like so, it works perfectly:
${responseVar.Results.output1.value.Values.get(0).get(0)}
Now I want to evaluate if the value is equal to “4” or not. It’s a simple string. The expression is like so:
${responseVar.Results.output1.value.Values.get(0).get(0) == '4' }
This does not evaluate, and I get this error:
no outgoing sequence flow of the exclusive gateway could be selected for continuing the process
I’ve done some debugging to see the output on some forms, and that expression evaluates to a string version of the expression itself, so something didn’t work.
For comparison, I tried the following syntax for an expression to get the value of type:
${responseVar.Results.output1.type == 'table'}
This works perfectly! Hypothesizing that this has something to do with my results being in an array, I tried evaluating against the first element in the ColumnNames array:
${responseVar.Results.output1.value.ColumnNames.get(0) == 'Scored Labels'}
It didn’t work. Same issue as before.
All this to say, is there something different I should be doing syntactically to evaluate against my chosen values if they’re retrieved from an array and I’m using the .get() function?
Any help would be greatly appreciated! Thank you!