Hi folks,
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.
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.
Here is the flow in edit mode:
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
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:
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:
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:
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:
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:
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:
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:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
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
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)
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional