获取逻辑应用 for 循环中当前步骤的编号

问题描述 投票:0回答:1

我的逻辑应用程序中有一个 for 循环,其中有 1000 多个要循环的内容。逻辑应用程序中的某些项目走不同的路径,我想通过将步骤号和项目名称添加到数组来跟踪哪些项目执行此操作。

所以我想要一个像

["itemABC", "505"]
一样的数组。然后,当我在 foreach 循环中转到“505”时,它会向我显示相同的项目。这在逻辑应用程序中可能吗?

azure for-loop azure-logic-apps
1个回答
0
投票

获取逻辑应用 for 循环中当前步骤的编号

是的,您可以使用以下方法来做到这一点

design

enter image description here

enter image description here

要实现此功能,您需要将并发数更改为1(如果未设置,您将随机获得):

enter image description here

Output:

enter image description here

CodeView:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Compose_2": {
                "inputs": "@variables('arvar')",
                "runAfter": {
                    "For_each": [
                        "Succeeded"
                    ]
                },
                "type": "Compose"
            },
            "For_each": {
                "actions": {
                    "Append_to_array_variable": {
                        "inputs": {
                            "name": "arvar",
                            "value": "'[@{items('For_each')},@{variables('incvar')}]'"
                        },
                        "runAfter": {
                            "Increment_variable": [
                                "Succeeded"
                            ]
                        },
                        "type": "AppendToArrayVariable"
                    },
                    "Increment_variable": {
                        "inputs": {
                            "name": "incvar",
                            "value": 1
                        },
                        "runAfter": {},
                        "type": "IncrementVariable"
                    }
                },
                "foreach": "@variables('var')",
                "runAfter": {
                    "Initialize_variable_3": [
                        "Succeeded"
                    ]
                },
                "runtimeConfiguration": {
                    "concurrency": {
                        "repetitions": 1
                    }
                },
                "type": "Foreach"
            },
            "Initialize_variable": {
                "inputs": {
                    "variables": [
                        {
                            "name": "var",
                            "type": "array",
                            "value": [
                                "rithwik",
                                "bojja",
                                "Charlie",
                                "David",
                                "kingu",
                                "Frank",
                                "Grace",
                                "pangu",
                                "Chotu",
                                "Julia",
                                "test",
                                "Lily",
                                "mangu",
                                "Nora",
                                "Oliver",
                                "jangu"
                            ]
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            },
            "Initialize_variable_2": {
                "inputs": {
                    "variables": [
                        {
                            "name": "incvar",
                            "type": "integer",
                            "value": 0
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Initialize_variable_3": {
                "inputs": {
                    "variables": [
                        {
                            "name": "arvar",
                            "type": "array"
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_2": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {}
}
© www.soinside.com 2019 - 2024. All rights reserved.