Search code examples
conditional-statementsazure-logic-appsstring-lengthpower-automate

Power Automate to alert if file NOT created, Condition on length of array


I'm using the below to check if a file has been created in a folder. If it hasn't been done someone's forgotten and we need an alert. Listing the folder, and the two filters give the results I'd expect. The FilterTimes uses Addhours/UTCNow(-ve) so only files newer than the threshold make it through.

However, if there are no new files, the output of the last filter is Body[] as expected, but when this get passed to the condition, I'm just getting the input of that being { "expressionResult": false}

I think I'm getting my brackets and commas wrong in the condition, or have I named the array incorrectly?

screenshot


Solution

  • Please input expression length(body('FilterTimes')) to the left input box of "Condition" but not input the string length(body('FilterTimes')) to the box. The string length(body('FilterTimes')) doesn't equal to 0, so the result is false.

    I do the same steps in my power automate, it works fine if I input the expression.

    enter image description here