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

Community site session details

Session Id : 4cQ+UZ2zQT2/PEUn/Gd2Gp
Power Automate - Building Flows
Answered

startWith to search range of characters

Like (0) ShareShare
ReportReport
Posted on 21 Jul 2020 17:48:13 by 36

I'm trying to search the first character of the last name. If the first letter begins with letters A - L then and email should be sent to one person and if the last name begins with the letter M - Z then an email should be sent to another person.

 

Here is the expression I'm using

startsWith(body('Get_response_details')?['r5fe8a238040a4b92a9bdb86b6c621c29'], 'A-L').
 
Thank you for your help.
  • d11scott Profile Picture
    8 on 28 Nov 2023 at 22:34:02
    Re: startWith to search range of characters

    There is a different way to do this by:

    1. Creating a 1 character string variable with this as the Value: substring(triggerOutputs()?['body/Title'],0,1)

    2. Then use the Condition Control to test the variable. I selected the "is greater than or equal to" and "is less than or equal to" options in the dropdown and also used AND.

     

    This is a pic of the flow:

    d11scott_0-1701210656809.png

    d11scott_1-1701210698457.png

     

    This worked for me in all my tests. If the input for the variable is not already a string, you would need to convert it to a string in the formula.

     

    Scott

     

  • Verified answer
    Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on 24 Jul 2020 at 02:35:46
    Re: startWith to search range of characters

    @cmp1900 

     

    Thats the reason i nested condition action. You can see for K and L which i added in second condition action.

    First condition action  check for A to J letter if true send email. If false it will go to second condition action where test for J and K will be happened, if yes send same email in yes block. If false No block will work for rest of the letter here send email for letter M to Z.

    Try it this will work.

    Thanks

    Hardesh

  • cmp1900 Profile Picture
    36 on 23 Jul 2020 at 18:48:11
    Re: startWith to search range of characters

    Thank for that idea. But I think I need another solution since there is a limit of 10 conditions and I would need at least 12. 

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on 23 Jul 2020 at 17:49:55
    Re: startWith to search range of characters

    @cmp1900 

     

    Currently i have this kind of idea with Condition action- Use OR with each condition. and Start with in each condition.

    Annotation 2020-07-23 211711.jpg

    In YES block use email action for A to L and in NO use email for M-Z.

    Thanks

    Hardesh

     

  • cmp1900 Profile Picture
    36 on 23 Jul 2020 at 17:32:24
    Re: startWith to search range of characters

    Thank you.

     

    To clarify, I'm trying to use starstWith to find if the text starts in a range of characters. For example, I want to know if a last name start with the letter between A and L. Is there a way to do something like this ^[A-L] in the StartText option? StartsWithTextStartText ).

     

    Thank you

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on 23 Jul 2020 at 16:19:12
    Re: startWith to search range of characters

    @cmp1900 

     

    Pls add this "body('Get_response_details')?['r5fe8a238040a4b92a9bdb86b6c621c29']" in compose action  and then you can see what is output of your input.

     

    StartsWith function is case sensitive. for more information you can refer-

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-startswith

     

    Thanks

    Hardesh

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete