Skip to main content
Community site session details
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.

  • 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 🙂

  • 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

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

Loading complete