cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Naresh
Helper IV
Helper IV

Removing the last character in the string.

Hi

 

I need an expression to remove the last character in the string in the Microsoft Flow.

 

Please assist.

1 ACCEPTED SOLUTION

Accepted Solutions
gamoraes
Memorable Member
Memorable Member

Hi @Naresh

 

it is simple, use this expression:

 

OBS: Don't forget to change the red text to your right action name, and the bold red number(1) are the quantity of chars to remove, in you case 1

substring(outputs('Compose_3'),0,sub(length(outputs('Compose_3')),1))

Look at my flow and result

Anotação.png

Anotação 1.png

 

Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


View solution in original post

6 REPLIES 6
gamoraes
Memorable Member
Memorable Member

Hi @Naresh

 

it is simple, use this expression:

 

OBS: Don't forget to change the red text to your right action name, and the bold red number(1) are the quantity of chars to remove, in you case 1

substring(outputs('Compose_3'),0,sub(length(outputs('Compose_3')),1))

Look at my flow and result

Anotação.png

Anotação 1.png

 

Best Regards,

 

Gustavo Moraes


Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!


I have an array with 10 value. I want to remove last index value of array(10th value). please guide me.

michaele124
Helper I
Helper I

I'm trying to remove the last character of a string that is the result of using the concat function within an apply to each.  It seems that this substring formula does not seem to be working inside an apply to each. I also tried the take function and to add -1 instead of subtracting. Any suggestions?

 

I'm assembling a tabel for an email from a SharePoint list that uses a multiselect column, so I'm using the concat function to turn the multiselected items for a single record together with a ";" in between so they can be included in the same cell within my table.  Unfortunately the last item has the ";" so I'd like to remove it.

 

I use the Compose function to create the concat and then Set variable as the output of the Compose. I was trying to put the substring formula as the Set variable value and it did not produce an error but the the ";" was still there.

Hi I've tried this but I'm getting the following error message each time I run this.  Can you please advise?

 

Lenfant_2-1637689016984.png

 

I've Initialized a variable

Lenfant_0-1637688882729.png

And created the below.

 

Lenfant_1-1637688934395.png

The full expression is as per below:

substring(outputs('Initialize_variable'),0,sub(length(outputs('Initialize_variable')),1))

Hey @Lenfant,

While working with variables, you should use the variables() function instead of the output() function. Simply write variables('Teststring') and it should work!

The full expression should look like this:

substring(variables('Teststring'),0,sub(length(variables('Teststring')),1))



Let me know if this solved your issue.

Kind Regards,

Frantisek Capek

Hi Frantisek,

 

Yes, thats how I end up doing it.  Works now.  Many thanks to come back to me.

 

Regards

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (4,365)