Need some help in powerautomate flow.
I have a filter array (
that returns this value:
6300 West Main St Midlothian VA 23112
I need some help getting the CITY (Midlothian for this record)
The I am using SPACE as a split delimiter, but that will be a problem if there are less spaces in some addresses.
Don't need state, and I am good on the ZIP :
Solved! Go to Solution.
Hi @MrAutomate ,
Why don't you try this,
split(split(body('Filter_array')[16],'VA')?[0],' ')?[sub(length(split(split(body('Filter_array')[16],'VA')?[0],' ')),2)]
In this, I'm getting the left part of "VA" and then using the length of array -2, I'm getting the city name.
Hope this helps 🙂
Kind Regards,
Shaik Sha
________________________________________________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Hi @MrAutomate ,
Why don't you try this,
split(split(body('Filter_array')[16],'VA')?[0],' ')?[sub(length(split(split(body('Filter_array')[16],'VA')?[0],' ')),2)]
In this, I'm getting the left part of "VA" and then using the length of array -2, I'm getting the city name.
Hope this helps 🙂
Kind Regards,
Shaik Sha
________________________________________________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Yes, that worked perfectly. I need to learn more on powerautomate, can you explain this section to help me understand how to apply for future usese? thanks!
?[sub(length(split(split(body('Filter_array')[16],'VA')?[0],' ')),2)]
@MrAutomate , Sure
As you know, we need to pass the index of element we need to fetch from the array that was split by space.
Using the Length() function I got the total length of splitted array. Then, as the index of array usually start from 0 and not 1, we need to subtract 1 from the length. Also, there is one extra space at the end, that means we want last but 1 element, not the final element. For this we need to subtract 1 again from the length. I've used the sub() function to do the subtraction.
To summarize, the length() function gives the total items in the array, and using the sub() function we are subtracting the length by 2 and getting the exact index where the city name is.