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 / Flow to extract substr...
Power Automate
Unanswered

Flow to extract substring fails to match Switch/Case

(0) ShareShare
ReportReport
Posted on by

Looked around on here and on the web but can't seem to find similar -- I'm sure there must have been but guess I'm not using sufficiently similar search syntax...

 

Created a flow to extract the last 4 characters from a filename when dropped into a library. Variables hold the filename, total length, number of characters to extract, etc. Filenames follow this convention: 601999999 - 0102.pdf. Once extracted, there's a 6-case Switch action, with the 7th as default. Depending on the value, it sends an email to different people.

 

Flow works just fine at extracting the last four. Result in above example is 0102. It pulls correctly into the Switch.

rb1_1-1593106920734.png

 

However, it doesn't match the matching Case:

 

rb1_2-1593107058032.png

 

I believe it has something to do with text vs number (string v integer), but can't seem to work it out.

 

Here's the Set Variable expression:

substring(variables('FullFileName'),variables('startPosition'),variables('subStringLength'))
 
And the Switch just holds that variable.
 
Should note that, when I go to enter the value in each Case, I get a mismatch error if I just type 0102. It will only be happy with "0102". Seems to make sense, since I'm pulling a sub"string" above.
 
What have I missed? I'm sure it's something stupidly simple.
Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Should add that when I named the file 601999999 - RBRB.pdf and put "RBRB" in the Case, everything worked as designed, further leading me to think string vs integer issue.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard