powerbidaxpower-automatepower-automate-desktop

Power Automate running query against Power BI data set error


I'm querying a Power BI dataset using Power Automate.

The query works fine - but when I check if the length of output is >0 (so I can determine whether to send a notification email or not), I receive the error:

Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'. Please see https://aka.ms/logicexpressions#length for usage details.'.

My flow is setup as:

enter image description here

My condition is setup as:

enter image description here

enter image description here

...and the error shows as:

enter image description here

I did also try:

length(outputs('Run_a_query_against_a_dataset')?['body/value'])

and

length(body('Run_a_query_against_a_dataset'))

Can anyone see what I've done wrong - I just want to check the length of "Run Query against a Dataset" - before I send an unnecessary email.

Thanks for your help,

Mark


Solution

  • Look at your output and you should see the node that is an array. It should be similar to:

    length(
      outputs('Run_a_query_against_a_dataset')?['body/firstTableRows']
    )
    

    It should also be available in the UI as a Dynamic element.