Hi.
GET_REST_VALUE command always gets the first found value that fits pattern to associate it with related variable. That's why your pattern finds all 7 objects, but returns only first one.
Questions:
1) is number of ItemType objects fixed or not?
2) Could you describe values usage please?
If you want to get all 7 values, but number of items is fixed, you should do next:
1) provide all 7 values names separated by commas, like val1,val2,val3, etc.
2) add all 7 paths like ItemTypes[1].Name, ItemTypes[2].Name, etc.
The problem is that it works only for fixed number of nodes. Also it's hard to operate with values like val1,val2,etc. if order can be changed.
That's why I had this 2nd question about usage.
I think this scenario will help you:
1) use Get_Rest_Value with BODY_JSON_COUNT type to get number of ItemTypes (ItemTypes.Name).
2) write LOOP - LOOP_END block from 0 to number of nodes -1
3) use Get_Rest_Value inside LOOP with same REST connection, but with search pattern like ItemTypes[@number].Name
4) do whatever you want with read value
Here is code example:
{
"steps" : [
{
"index" : 1,
"key" : "GET_REST_VALUE",
"model" : {
"statusVariableName" : "status",
"validationRequired" : false,
"variableName" : "number",
"fields" : [
{
"key" : "ItemTypes.Name",
"type" : "BODY_JSON_COUNT"
}
],
"excludeCharacters" : [ ],
"rest_connection" : "a",
"validation_file" : "<NOT SELECTED>"
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 2,
"key" : "SET_VAR",
"model" : {
"variableName" : "stack",
"sourceType" : "STATIC",
"value" : {
"encrypted" : false,
"raw" : "@System.empty"
},
"alphabet" : null,
"regex" : null,
"expressionLength" : 0
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 3,
"key" : "LOOP",
"model" : {
"variableName" : "index",
"from" : "0",
"to" : "@number-1",
"increment" : "1"
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 4,
"key" : "GET_REST_VALUE",
"model" : {
"statusVariableName" : "status",
"validationRequired" : false,
"variableName" : "name_var",
"fields" : [
{
"key" : "ItemTypes[@index].Name",
"type" : "BODY_JSON"
}
],
"excludeCharacters" : [ ],
"rest_connection" : "a",
"validation_file" : "<NOT SELECTED>"
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 5,
"key" : "PRINT",
"model" : {
"message" : "@name_var"
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 6,
"key" : "SET_VAR",
"model" : {
"variableName" : "stack",
"sourceType" : "STATIC",
"value" : {
"encrypted" : false,
"raw" : "@stack,@name_var"
},
"alphabet" : null,
"regex" : null,
"expressionLength" : 0
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 7,
"key" : "LOOP_END",
"model" : { },
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
},
{
"index" : 8,
"key" : "PRINT",
"model" : {
"message" : "@stack"
},
"skip" : false,
"runtimeOption" : "HALT",
"customCaption" : ""
}
]
}
Replace connection with the one you use and put it to advanced view.