我有一个变量,我将默认值设置为0。
在for_each中,我将新值设置为startIndex
变量,并在For_each中使用该变量,但仍使用旧的0
值。
逻辑应用程序代码-
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each_2": {
"actions": {
"Set_variable_3": {
"inputs": {
"name": "output",
"value": "@{split(items('For_each_2'),':')[0]}:@{substring(variables('mydata'),variables('startindex'),int(split(items('For_each_2'),':')[1]))}"
},
"runAfter": {},
"type": "SetVariable"
},
"Set_variable_4": {
"inputs": {
"name": "startIndex",
"value": "@int(split(items('For_each_2'),':')[1])"
},
"runAfter": {
"Set_variable_3": [
"Succeeded"
]
},
"type": "SetVariable"
}
},
"foreach": "@variables('splitvar')",
"runAfter": {
"Initialize_variable_9": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable_5": {
"inputs": {
"variables": [
{
"name": "mydata",
"type": "String",
"value": "abcdefg"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Initialize_variable_6": {
"inputs": {
"variables": [
{
"name": "key",
"type": "String",
"value": "AA:3;BB:2"
}
]
},
"runAfter": {
"Initialize_variable_5": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Initialize_variable_7": {
"inputs": {
"variables": [
{
"name": "splitvar",
"type": "Array",
"value": "@split(variables('key'),';')"
}
]
},
"runAfter": {
"Initialize_variable_6": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Initialize_variable_8": {
"inputs": {
"variables": [
{
"name": "output",
"type": "String"
}
]
},
"runAfter": {
"Initialize_variable_7": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Initialize_variable_9": {
"inputs": {
"variables": [
{
"name": "startIndex",
"type": "Integer",
"value": 0
}
]
},
"runAfter": {
"Initialize_variable_8": [
"Succeeded"
]
},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}
答案 0 :(得分:1)