web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Split string at partic...
Power Automate
Unanswered

Split string at particular word

(0) ShareShare
ReportReport
Posted on by 2

Good day,

 

My flow runs on email attachments if they have the words confirmation or nomination in them. Saves the attachment in a folder named after part of the attachment name.

 

eg1. 21141202SING - AQUARIUS CONFIDENCE Confirmation.pdf saved in folder 21141202SING - AQUARIUS CONFIDENCE 

eg 2. 21141402OPL - DAY Nomination.pdf saved in folder 21141402OPL - DAY  

 

I am struggling to remove the words confirmation or nomination (or any words past that) from the folder name

 

I have tried using 

 

first(split(variables('varAttachmentName'), 'Confirmation'))

 but the flow just seems to run indefinately

 

i have also tried using

 

replace(outputs('Compose_2'),'Confirmation',' ')
 
but the flow doesnt want to replace "confirmation" with a blank value
 
any help?
Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @malamenm 

     

    Here I have used split and replace expressions.

     

    image.png 

    Above expressions are as follows:

    first(split(outputs('Compose'),'Confirmation'))

    replace(outputs('Compose_2'),'Confirmation','')

     

    Here are my test results:

     

    image.png

     

    Your flow might be running indefinitely for different reasons. Could you please post a screenshot of your flow?

     

  • malamenm Profile Picture
    2 on at

    Dear @abm 

     

    I have tried to simplify the code for testing but still running indefinately

     

    please see below

    1.1.PNG2.PNG3.PNG

  • Paulie78 Profile Picture
    8,422 Moderator on at

    This expression should do what you want:

    concat
    (
    	if
    	(
    	 contains(variables('varAttachmentName'), 'Confirmation'), 
    	 trim(substring(variables('varAttachmentName'), 0, indexOf(variables('varAttachmentName'), 'Confirmation'))),
    	 ''
    	),
    	if
    	(
    	 contains(variables('varAttachmentName'), 'Nomination'), 
    	 trim(substring(variables('varAttachmentName'), 0, indexOf(variables('varAttachmentName'), 'Nomination'))),
    	 ''
    	)
    )

     

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @malamenm 

     

    There are couple of things you need to look here. Are you always expecting Confirmation and Nomination in your filenames as attachment. If so then add a check and make sure it contains the key words you looking for and clean up using the split or replace. 

     

    Next regarding the indefinite error you described.  It's the standard behaviour of SharePoint connector when it fails it goes for a retry mechanism and eventually you should get an error associated with that.  What's the final error you getting. Leave it running for few minutes and eventually you should get an error.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard