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

File name extraction, separate components into variable

Hi, everyone! I am relatively new to PAD, but I have seen how it can help increase my efficiency at work. With that said, I think I need a breakdown/better examples for what I want to do, if it is at all possible.

 

I work at a medical office, and daily, I am gathering information for patients to clear them for upcoming procedures. It is quite tedious to download a file, then upload the file, and search for the next file. From what I've researched, however, it seems that the following SHOULD be possible.

 

1. I still have to manually download a file, but I can save the file in this format: patient mrn - document type - date.pdf (so, for example, "12345 - ekg - 092421.pdf". I would like, upon file creation, for PAD to extract the three pieces of information and put them into a variable.

 

2. Once the information has been extracted, I want it to go to our EMR, enter in the patient's MRN, go to New Documents, type in the document type, then enter in the date, then upload the correct file.

 

I hope this makes sense, and I hope it is possible, or at least close enough to possible. Any feedback would be greatly appreciated! I'm still trying to figure everything out. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelAnnis
Super User
Super User

1)  download the file to a separate folder that is apart from where you keep all the other files.  This folder will act as a "to be processed" folder, and we can have PAD move it to the standard folder once the process is complete.

 

2)  Having the "to be processed" folder also allows you to run this whenever you want.  So, if there is 1 file or many in the "to be processed" it will process them all.  In Power Automate Desktop, without a paid license, you have to initiate the run manually.  So, you can do this as often as you want.

 

The flow will look something like this:

Get Files from 'C:\To be processed' to %Files% (a list variable of all filepath\filenames)

For each %CurrentItem% in %Files%

    Split Text %CurrentItem.NameWithoutExtension% by custom delimiter " - " to %TextList%

        In this example, %TextList% should result in a List as follows:

            12345 (Index 0)

            ekg (Index 1)

            092421 (Index 2)

    'Here, inside the For Each Loop, you would put in your EMR processing actions.  You can reference an Index of the %TextList% as %TextList[Index#]; ex:

        %TextList[0]% is for the patient's MRN

        %TextList[1]% is for the procedure

        %TextList[2]% is for the date

    After all your EMR actions are complete:

    Move Files %CurrentItem% to C:\done (or whatever your proper folder is)

End

 

You could put the move files at the end and do them all at the same time; however, if this errors out in the middle, I don't think you want to risk duplicating the item in EMR.  So I would move each file as it finishes and if it does break, you know the ones in "to be processed" still need processed.

 

best of luck!

View solution in original post

3 REPLIES 3
UK_Mike
Post Prodigy
Post Prodigy

This will get the file details...

 

 

Screenshot 2022-02-17 151802.png

MichaelAnnis
Super User
Super User

1)  download the file to a separate folder that is apart from where you keep all the other files.  This folder will act as a "to be processed" folder, and we can have PAD move it to the standard folder once the process is complete.

 

2)  Having the "to be processed" folder also allows you to run this whenever you want.  So, if there is 1 file or many in the "to be processed" it will process them all.  In Power Automate Desktop, without a paid license, you have to initiate the run manually.  So, you can do this as often as you want.

 

The flow will look something like this:

Get Files from 'C:\To be processed' to %Files% (a list variable of all filepath\filenames)

For each %CurrentItem% in %Files%

    Split Text %CurrentItem.NameWithoutExtension% by custom delimiter " - " to %TextList%

        In this example, %TextList% should result in a List as follows:

            12345 (Index 0)

            ekg (Index 1)

            092421 (Index 2)

    'Here, inside the For Each Loop, you would put in your EMR processing actions.  You can reference an Index of the %TextList% as %TextList[Index#]; ex:

        %TextList[0]% is for the patient's MRN

        %TextList[1]% is for the procedure

        %TextList[2]% is for the date

    After all your EMR actions are complete:

    Move Files %CurrentItem% to C:\done (or whatever your proper folder is)

End

 

You could put the move files at the end and do them all at the same time; however, if this errors out in the middle, I don't think you want to risk duplicating the item in EMR.  So I would move each file as it finishes and if it does break, you know the ones in "to be processed" still need processed.

 

best of luck!

Oh, this opens up so many other avenues for me, too! Once I verify it working, I'll accept this as solution. Thank you so much!

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!

Top Solution Authors
Top Kudoed Authors
Users online (2,634)