I’m trying to add a new line in a concat in azure logic apps. but it only adds the new line as a string instead.
My goal is to add an array of object I get into a word doc. but it doesnt add a new line but actually adds the characters.
This is how I’m implementing this.
I have tried with <br> and n
2
{ "concatenatedText": "@concat(‘Line 1’, ‘n’, ‘Line 2’, ‘n’, ‘Line 3’)" }
How to add a New Line in Azure Logic app, concat method?
I have reproduced in my environment and below is expected results:
Design:
Here you can add new line by creating a variable with new line like just pressing enter in value(of Initialize variable action).
Then the conact statement:
conact
concat(items('For_each')['Firstname'],variables('newline'),items('For_each')['Lastname'],variables('newline'),items('For_each')['Whatname'])
Output:
Code view:
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "For_each": { "actions": { "Compose": { "inputs": "@concat(items('For_each')['Firstname'],variables('newline'),items('For_each')['Lastname'],variables('newline'),items('For_each')['Whatname'])", "runAfter": {}, "type": "Compose" } }, "foreach": "@body('Parse_JSON')", "runAfter": { "Initialize_variable": [ "Succeeded" ] }, "type": "Foreach" }, "Initialize_variable": { "inputs": { "variables": [ { "name": "newline", "type": "string", "value": "n" } ] }, "runAfter": { "Parse_JSON": [ "Succeeded" ] }, "type": "InitializeVariable" }, "Parse_JSON": { "inputs": { "content": "@triggerBody()", "schema": { "items": { "properties": { "Firstname": { "type": "string" }, "Lastname": { "type": "string" }, "Whatname": { "type": "string" } }, "required": [ "Firstname", "Lastname", "Whatname" ], "type": "object" }, "type": "array" } }, "runAfter": {}, "type": "ParseJson" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": {}, "triggers": { "manual": { "inputs": { "schema": {} }, "kind": "Http", "type": "Request" } } }, "parameters": {} }
Click here to cancel reply.
2
Answers
I have reproduced in my environment and below is expected results:
Design:
Here you can add new line by creating a variable with new line like just pressing enter in value(of Initialize variable action).
Then the
conact
statement:Output:
Code view: