skip to Main Content

There is a variable in ADF that holds the below value.

@json(concat('{','"S.No":',variables('counter'),',"Input Table":"Input TblName","Output Table":"[Tbl1, tbl2, Tbl3]", "Status":"Successful"}'))

I pass this variable to a logic app using Web activity and use ‘Create HTML Table’ to convert this json to a table.

Apparently, the below is what I will get if I do so

SNo Input Table Output Table Status
1 Input Table Name [Tbl1, tbl2, Tbl3] Successful

But I want it to be displayed as below.

SNo Input Table Output Table Status
1 Input Table Name Tbl1 Successful
2 Input Table Name tbl2 Successful
3 Input Table Name Tbl3 Successful

Is there any way to achieve this is ADF pipeline expression builder

2

Answers


  1. If the variable counter works for the tables naming you can do the following:

    @json(concat('{','"S.No":',variables('counter'),',"Input Table":"Input TblName","Output Table":"tbl',variables('counter'),'", "Status":"Successful"}'))
    

    If not you will need to have a list of JSON objects like this:

    @json(concat('{','"S.No":',variables('counter'),',"Input Table":"Input TblName","Output Table":"Tbl1", "Status":"Successful"},{','"S.No":',variables('counter'),',"Input Table":"Input TblName","Output Table":"tbl2", "Status":"Successful"},{','"S.No":',variables('counter'),',"Input Table":"Input TblName","Output Table":"Tbl3", "Status":"Successful"},'))
    
    Login or Signup to reply.
  2. You can customize the JSON in Logic Apps itself using below design and process:

    Input:

    {
    
    "Input Table": "Rith Table",
    "Output Table":"[Tbl1, tbl2, Tbl3]",
    "Status":"Successful"
    
    }
    

    Design:

    enter image description here

    Then:

    enter image description here

    Output:
    enter image description here

    enter image description here

    Codeview to Replicate the same:

    {
        "definition": {
            "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
            "actions": {
                "Compose_2": {
                    "inputs": "@split(body('Parse_Json')?['Output Table'], ',')",
                    "runAfter": {
                        "Parse_JSON": [
                            "Succeeded"
                        ]
                    },
                    "type": "Compose"
                },
                "Create_HTML_table": {
                    "inputs": {
                        "format": "HTML",
                        "from": "@variables('var')"
                    },
                    "runAfter": {
                        "For_each": [
                            "Succeeded"
                        ]
                    },
                    "type": "Table"
                },
                "For_each": {
                    "actions": {
                        "Append_to_array_variable": {
                            "inputs": {
                                "name": "var",
                                "value": {
                                    "Input Table": "@{body('Parse_JSON')?['Input Table']}",
                                    "Output Table": "@{replace(replace(items('For_each'),'[',''),']','')}",
                                    "Sno": "@{variables('var2')}",
                                    "Status": "@{body('Parse_JSON')?['Status']}"
                                }
                            },
                            "runAfter": {
                                "Increment_variable": [
                                    "Succeeded"
                                ]
                            },
                            "type": "AppendToArrayVariable"
                        },
                        "Increment_variable": {
                            "inputs": {
                                "name": "var2",
                                "value": 1
                            },
                            "runAfter": {},
                            "type": "IncrementVariable"
                        }
                    },
                    "foreach": "@outputs('Compose_2')",
                    "runAfter": {
                        "Compose_2": [
                            "Succeeded"
                        ]
                    },
                    "type": "Foreach"
                },
                "Initialize_variable": {
                    "inputs": {
                        "variables": [
                            {
                                "name": "var",
                                "type": "array"
                            }
                        ]
                    },
                    "runAfter": {
                        "Initialize_variable_2": [
                            "Succeeded"
                        ]
                    },
                    "type": "InitializeVariable"
                },
                "Initialize_variable_2": {
                    "inputs": {
                        "variables": [
                            {
                                "name": "var2",
                                "type": "integer",
                                "value": 0
                            }
                        ]
                    },
                    "runAfter": {},
                    "type": "InitializeVariable"
                },
                "Parse_JSON": {
                    "inputs": {
                        "content": "@triggerBody()",
                        "schema": {
                            "properties": {
                                "Input Table": {
                                    "type": "string"
                                },
                                "Output Table": {
                                    "type": "string"
                                },
                                "Status": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "runAfter": {
                        "Initialize_variable": [
                            "Succeeded"
                        ]
                    },
                    "type": "ParseJson"
                }
            },
            "contentVersion": "1.0.0.0",
            "outputs": {},
            "parameters": {},
            "triggers": {
                "manual": {
                    "inputs": {
                        "schema": {}
                    },
                    "kind": "Http",
                    "type": "Request"
                }
            }
        },
        "parameters": {}
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search