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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Split Value and String
Power Automate
Answered

Split Value and String

(0) ShareShare
ReportReport
Posted on by 49

Hi folks,

notitle.png

How can i split that to be numbers and letters separately? Like this '231129' 'Felicia Iliescu'

It always contains numbers and letters of different character length not like in the image.

'231129Felicia Iliescu' is my result of extracted text in power automate which is responded to power apps and i want to split that result.

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,194 Most Valuable Professional on at

    Hi @Pabblo_96,

     

    That first part looks a lot like a date value (in yyMMdd format)? In other words, is the first part the numbers always 6 characters long?

     

    In that case try this for the numbers part

    substring(variables('OrderID'), 0, 6)

     

    And this for the letters part

    slice(variables('OrderID'), 6)

     

    date_string_split.png

     

     

     

  • Pabblo_96 Profile Picture
    49 on at

    Hi @Expiscornovus 

    No it's not a date value.

    I know i can do this that way but the problem is that sometimes order ID have 6 characters and sometimes 8. Same is with first name and last name, they are different always

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Pabblo_96 

     

    Here is the sample flow that will work for any number of character in order ID.

     

    I have stored the input string in compose action:

    ManishSolanki_0-1707051874815.png

    231129Felicia Iliescu

     

    Next, add "Select" action which takes each character and create an array of objects with 2 properties - IsNumeric and Value. We will use expression to create an array:

    ManishSolanki_1-1707052091657.png

    Below expression needs to be added in the expression box as highlighted in the above screenshot:

    range(1,length(outputs('Compose')))

    Following text/expression is used for key/value in Map parameter:

    Key Value
    IsNumeric
    isInt(take(outputs('Compose'),item()))
    Value
    take(outputs('Compose'),item())

     

    Now, we will filter the output of select action that contains only numeric values using "Filter array" action. Pass the output of Select action as input:

    ManishSolanki_2-1707052393136.png

    Click "Edit in advanced mode" and enter the below query:

    @equals(item()?['IsNumeric'], true)

     

    Post filtering, add compose action to get the required numeric value which will be the last element with IsNumeric as true in the output body of filter array action:

    ManishSolanki_3-1707052576476.png

    last(body('Filter_array'))?['Value']

     

    Finally, add another compose action to get the text value from the input string. We will replace the numeric value collected in compose action with empty string from original input string:

    ManishSolanki_4-1707052783937.png
    replace(outputs('Compose'),outputs('Compose_2'),'')

     

    The output of compose 2 action will give the numeric value and text part will be collected in compose 3 action.

     

     

    Output:

    ManishSolanki_5-1707052878907.pngManishSolanki_6-1707052897761.png

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Pabblo_96,

     

    @ManishSolanki highlighted this post to me after I created a video to do something similar https://youtu.be/_6f5UBpHhZ0

     

    In this video you will learn how to remove or keep characters, symbols or numbers in a string with 1 action.  For example, using your requirement we can use one select to keep the integers and another select to keep the non integers and return both strings with a join expression.

     

    DamoBird365_0-1711271938965.png

    Here is the flow in edit mode:

    DamoBird365_1-1711271992348.png

    FROM of the select is:

    chunk(outputs('Compose'),1) which turns your string into an array (as seen in the video)

     

    Note that text mode is enabled on the select MAP.

     

    to keep integers you can use if(isInt(item()),item(),'') which if isint is true, we output the integer, otherwise we output an empty string ''.

     

    to keep the non integers (i.e. the characters) you can use if(isInt(item()),'',item()) which if isint is true, we output the an empty string '' otherwise we output the non integer value.

     

    To get the string of both selects, you can use join(body('SelectIsInt'),'') or join(body('SelectString'),'')

     

    My video above will explain this in more detail and hopefully open up more ideas for efficiency too.


    Cheers
    Damien

    Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts. Thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard