cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ankit77
Helper I
Helper I

How to get string before a character appearing multiple times in power automate

I have this string and I need to get the first character before my date value start. so for example if I have name as ZXDER_20201209220430Z I need ZXDER, if I have ZXDDFR_IUT_23_20201209220430Z I need ZXDDFR_IUT_23. How do I do this once in Power automate. My value after last underscore will always be date value.

1 ACCEPTED SOLUTION

Accepted Solutions

@Ankit77 

You can use below expression for that

substring(outputs('Compose'),lastIndexOf(outputs('Compose'),'_'),length(outputs('Compose')))

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if the information shared helps you, please consider giving a thumbs up and mark solution as resolved

View solution in original post

3 REPLIES 3
Gopala_Krishna
Super User
Super User

@Ankit77 

You can achieve this using below expression in power automate

substring(outputs('Compose'),0,lastIndexOf(outputs('Compose'),'_'))

Replace the outputs('Compose') to the action from where you are fetching the data.

For my example I have taken the sentence how_are_you and stored it in compose action.

Gopala_Krishna_0-1614605665171.png

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if the information shared helps you, please consider giving a thumbs up and mark solution as resolved

@Gopala_Krishna great!!! and what if we need the date part, i.e. the value after last "_"

@Ankit77 

You can use below expression for that

substring(outputs('Compose'),lastIndexOf(outputs('Compose'),'_'),length(outputs('Compose')))

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if the information shared helps you, please consider giving a thumbs up and mark solution as resolved

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (67,254)