Skip to main content
Community site session details

Community site session details

Session Id : 1k//iFWROh8W4zJgK/iwzm
Power Automate - Building Flows
Answered

Is it possible to use dynamic content and static content in a single condition value?

Like (0) ShareShare
ReportReport
Posted on 17 Sep 2019 18:08:33 by 42

I'm working on a Flow that automatically emails files added to a Sharepoint Library. The recipient of said files is determined by a four digit prefix on the filename which I'm checking against a Sharepoint List containing the four digit code and an associated e-mail address.

 

flow.png

 

From the image above, I'm hoping to have something like Code+_ to account for an underscore in the filename. In the event we ever have five digit codes (or human error), I don't want 0123 to receive the emails intended for 01234. I've thought about just adding the underscore to the Code in the Sharepoint List, but for aesthetic reasons I'm not sure it'll fly internally.

  • MattWeston365 Profile Picture
    1,701 on 01 Oct 2019 at 11:51:24
    Re: Is it possible to use dynamic content and static content in a single condition value?

    With regards to the non-matching, you would either need to remove the filter from Get Items, and then use a condition within your Flow to set the status as either Sent or Failed. Alternatively you could have a second Get Items which has the negative filter. Rather than your filter being FIELDA eq MYVALUE, it would be FIELDA ne MYVALUE.

     

    Another consideration is that your SHarePoint list could be Failed as the default value, therefore will only change to sent when it has been processed.

  • MattWeston365 Profile Picture
    1,701 on 01 Oct 2019 at 11:49:00
    Re: Is it possible to use dynamic content and static content in a single condition value?

    Hi @ac1drain the action Get Files, or Get Items will always return an array. So if you have multiple files which meet your filter criteria then you will get all of them back. You just then need to handle the multiple files, usually within the loop.

  • ac1drain Profile Picture
    42 on 30 Sep 2019 at 19:41:19
    Re: Is it possible to use dynamic content and static content in a single condition value?

    @MattWeston365Is it possible to work with the files that did not match the filter query? Currently, once a match is made, the file contents are pulled, sent in an email, and then a Sharepoint property I've called Status is updated to "Sent". I'd like to be able to update the property of the non-matched documents to "Failed".

  • ac1drain Profile Picture
    42 on 23 Sep 2019 at 19:39:22
    Re: Is it possible to use dynamic content and static content in a single condition value?

    @MattWeston365Sorry, if I may bug you one last time while we're on this topic... is it possible to build an array of attachments if there are multiple files with the same prefix?

  • ac1drain Profile Picture
    42 on 23 Sep 2019 at 15:57:15
    Re: Is it possible to use dynamic content and static content in a single condition value?

    @MattWeston365That was it, thank you! It's working as expected.

  • Verified answer
    MattWeston365 Profile Picture
    1,701 on 23 Sep 2019 at 15:40:29
    Re: Is it possible to use dynamic content and static content in a single condition value?
    Just looking on my mobile which isn’t great, but it looks like it’s the name of the apply to each in your expression. I’d renamed my apply to each to include the word file, whereas yours is just “apply to each”. Therefore, in your expression, it will be Apply_to_each

    Give that a go. I’m just about to board a flight but will be back online in a couple of hours if you don’t get anywhere
  • ac1drain Profile Picture
    42 on 23 Sep 2019 at 15:14:03
    Re: Is it possible to use dynamic content and static content in a single condition value?

    Hi @MattWeston365, thanks for sharing this. Reading through it makes perfect sense, but putting it into practice has me a bit stumped (sorry, I'm quite new to Flow). Are you able to tell me what I'm doing wrong from the image below? The Site Address are properly populated, just redacted for privacy.

     

    flow.png

  • Verified answer
    MattWeston365 Profile Picture
    1,701 on 18 Sep 2019 at 20:47:40
    Re: Is it possible to use dynamic content and static content in a single condition value?

    Hi @ac1drain, what you're describing is perfectly possible. As long as you have a consistent delimeter between the Code and the Main document name then you're in a good position. The following method will work regardless of how many characters are in your org code.

     

    In my Flow, I have used a manual trigger to start (obviously use whatever you need here), and then I Get Files (Properties Only) in order to process them. I then have something similar to you.

     

    The first thing I call is "Get Items", however when I build my Filter Query, I use an expression called Split. Split allows me to take a string, and break it on a specific character. The result is that I then have a string array. So for example, if my document is called: 0123-V365Doc.docx, and I split on a hyphen (-) then this will be split into:

    0123 - This is given an index of 0

    V365Doc.docx - This is given an index of 1

     

    I can then use that within my Filter query, where I split my string on a defined character, and tell it to use index 0. I know I'm talking geek here but stay with me, it will all make sense in a moment 🙂 My expression is:

    Split(items('Apply_to_each_file')?['{Name}'],'-')[0]

    Name is the filename, "-" is the split character, and [0] is the index

     

    When it goes into my Flow, it looks like this:

    ApplyToEach.PNG

    Using this method, it won't matter if my code is:

    0123

    01234

    012345

    They will all be treated differently, and the correct lookup will be performed on the OrgCode list.

     

    I hope that makes sense 🙂

  • v-alzhan-msft Profile Picture
    on 18 Sep 2019 at 07:13:58
    Re: Is it possible to use dynamic content and static content in a single condition value?

    Hi @ac1drain ,

     

    If you have any problems while creating the flow, feel free to ask for help here.    

     

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • RezaDorrani Profile Picture
    12,141 on 17 Sep 2019 at 18:19:45
    Re: Is it possible to use dynamic content and static content in a single condition value?

    Hi @ac1drain 

     

    Your names will need to have some pattern else you will run into 0123 and 01234 related issues since startswith or even contains will be the same case

     

    You would need to either have a column which has the exact name in it so you can perform an equals operation or

    the name would have to start with

    0123_ or 01234_ so you can do contains the code_ format

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2