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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (38,432)