web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Clean up output of fil...
Power Automate
Answered

Clean up output of filter array to remove the [" "] around the filtered result, or otherwise enable comparing a filter array output to a compose output

(0) ShareShare
ReportReport
Posted on by 42

Hi. I have a Filter array that successfully filters out a word from an incoming email, but it displays it with [" "] around it (per the top part of the attached image. The goal is to compare that string in between the [" "] with an output of a Compose action that is a filtered list from a List files in folder action.

 

The filter array expression that extracts the text I need from an email: and(startsWith(item(),'BC'),endsWith(item(),'JDF'))

The compose expression that gets a list of folder names from a target folder (big thanks to @v-yueyun-msft for working this out for me!): xpath( xml(json(concat('{"root":{"item":',outputs('List_files_in_folder')?['body/value'],'}}'))) , '/root/item[IsFolder="true"]/Name/text()')

 

A Condition action is then set up to see if the compose output contains the filter array output and give a yes/no if a match is found; it always returns a false result, even though there is a match. I think it's because it is comparing all of the characters in the filter array out, including the [" "], is that how it works?

 

Can anyone help with this? I thought I had this problem sorted out, but the method I planned to use doesn't work on an array..

filtering array output 2.png
Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi, @DanJECC 

    Do you mean you want to compare the array if contains one Text string?

    Like Apps exist in this array:

    vyueyunmsft_0-1710740649005.png

    If this , you can refer to this flow:

    vyueyunmsft_1-1710740764864.png

    We can use this expression in the left of the condition:

     

    join(xpath( xml(json(concat('{"root":{"item":',outputs('List_files_in_folder')?['body/value'],'}}'))) , '/root/item[IsFolder="true"]/Name/text()'),',')
     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

  • DanJECC Profile Picture
    42 on at

    Hi. Thank you helping again, sorry for the delayed response.

     

    That expression doesn't work, it gives the below error:

    InvalidTemplate. Unable to process template language expressions for action 'Condition_1' at line '0' and column '0': 'The template language function 'contains' expects parameters of matching types: a dictionary and a key (string), an array and a value (object), or a string and a substring. The provided types 'String' and 'Object' are incompatible. Please see https://aka.ms/logicexpressions#contains for usage details.'.

     

    Basically what I want to do is clean up the output of a Filter array action from this:

    [
     "example"
    ]

     

    to this:

    example

     

    I need to do two things with the output of the Filter array action:

    1. I want to use the Condition action to see if the output of a Compose action contains the outputs of the Filter array action.
    2. If the result is true, I then want to use the output of the Filter array in a dynamic folder path of a Create file action, like this:

    DanJECC_0-1710891977261.png

     

    Therefore the text of the Filter array output needs to be just text I want, without the [' '] around it. Hopefully that makes sense.

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi, @DanJECC 

    If you want to get the string in an array , you can directly use the apply to each to loop your array and then use the item() to get the string in your array in my understand. You can refer to this flow:

    vyueyunmsft_0-1710896286674.png

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

     

  • DanJECC Profile Picture
    42 on at

    I'm not sure I set it up correct, I am still trying to wrap my head around expressions.

    DanJECC_1-1710899585533.png

     

    It results in this error:

    DanJECC_0-1710899284760.png

  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi, @DanJECC 

    Thanks for your response! You need to use this in your Apply to each:

    vyueyunmsft_0-1710899832052.png

    body('Filter_array')

     

    Best Regards,

    Yueyun Zhang

  • DanJECC Profile Picture
    42 on at

    Thank you! Like I said I'm still learning expressions, didn't notice the difference between body and outputs. Also took some trial and error with the hierarchy, the first Condition action (and everything after it) needed to be moved inside of the Apply to each action, but it now all works!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard