Actually I don't know if this will work. But I have long array with a lot of elements, I need to display all element in order on the body/description of Jira ticket without writing it manually (example: outputs('Compose')?[0] outputs('Compose')?[1] outputs('Compose')?[2]
). Is there anyway to do it using loop? or any other method?
Note: I don't want it to be as paragraph I need it the same as the array listed.
Example array:
[ 'first element', 'second element', 'third element', ]
printed/displayed format:
first element
second element
third element
I tried using loop but don't understand it.
please consider that I'm new to the Logic App or any other technologies with the same idea
There are ways which we can perform data operations such as:
Option 1: Line by line
Firstly, I have initialized a variable as below:
Then used Join (Data Operations) as below:
(here I just clicked Enter in Join with )
Output:
Code view:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "emo",
"type": "array",
"value": [
"rithwik",
"bojja",
"chotu"
]
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Join": {
"inputs": {
"from": "@variables('emo')",
"joinWith": "\n"
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Join"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}
So now you can use the output of Join(body('Join')
Option 2: Spaces
If you keep space in Join you will get ouput as below:
Output:
Code view:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "emo",
"type": "array",
"value": [
"rithwik",
"bojja",
"chotu"
]
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Join": {
"inputs": {
"from": "@variables('emo')",
"joinWith": " "
},
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Join"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}