Search code examples
arraysloopsnullelementazure-logic-apps

Logic app check null values on array then replace it with string


So I am trying to check for array null values inside a loop but I don't really know the right format for that

Array example:

[
  'value 1',
  'value 2',
  '',
  'value 4',
]

this is the expression that I tried to write:

if(empty(outputs('splitTD')[variables('FirstRecord')]), replace(outputs('splitTD')[variables('FirstRecord')], '', 'Not specified' ), outputs('splitTD')[variables('FirstRecord')])

Solution

  • I have reproduced in my environment and got expected results as below:

    Firstly, I have initialized array with your given input and then again initialized another empty array and then, I have used condition if(empty(item()),'No Element',item()) in for each loop and got results and followed below process:

    enter image description here

    The in compose variable as below:

    enter image description here

    Output:

    enter image description here

    Edit:

    You need to on your concurrency as below for getting in Right Order:

    enter image description here