cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Extracting file name and using within flow

Hello!

 


I have a flow where I wish to extract the filename of the file, but without the extension.

 

So if it was "somepicture.jpg", I want to use "somepicture" in the HTTP post later on.

 

My flow looks like this:

flow.jpg

 

I have spent a lot of time trying to get this to work, and have tried multiple options for extracting the filename.

 

I am sure that I must be close.. but I can't quite figure it out.

 

Any ideas? I'm happy to do it another way, just as long as it works.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: mRe: Extracting file name and using within flow

Fixed it!

 

I don't know why - but using the dynamic expression for 'filename' always gives a garbled end result.

 

The only way to do it, was to initialise the variable first, and then later use it.

 

 

flow3.jpg

View solution in original post

5 REPLIES 5
Highlighted
Community Support
Community Support

Re: Extracting file name and using within flow

Hi @agour,

 

To extract the file name of the file without the extension, please try to combine functions split and first.

 

You could use the following code:

first(split(triggerOutputs()['headers']['x-ms-file-name-encoded'],'.'))

 

Then you could use the output from the Compose in the next action.

1.PNG

 

Please try it on your side.

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Extracting file name and using within flow

Hi Mabel,

 

I tried your suggestion, which makes sense to me.

 

The output from the compose action is a random string of charectors. Any idea what is going on?

 

flow.jpg

 

The actual filename was "McGoff_00018.jpg"

 

 

Thanks!

Highlighted
Frequent Visitor

mRe: Extracting file name and using within flow

Bump - any further ideas? I still need to try and get this fixed

Highlighted
Frequent Visitor

Re: mRe: Extracting file name and using within flow

I have tried using Onedrive as the input, rather than ftp... and I still get the same issues.

 

I also tried using a replace function:

 

replace(triggerOutputs()['headers']['x-ms-file-name-encoded'], '.jpg', '')
 
And I still get the same strange string of charectors as the output..
Highlighted
Frequent Visitor

Re: mRe: Extracting file name and using within flow

Fixed it!

 

I don't know why - but using the dynamic expression for 'filename' always gives a garbled end result.

 

The only way to do it, was to initialise the variable first, and then later use it.

 

 

flow3.jpg

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (7,126)