Hi,
So I have a teams site in which I'll have reports being uploaded daily, and with this I have a progress tracker (done as a list) for each report. I have a total of 11 files that will be uploaded every day with each having a keyword that's always included in the file name. My goal out of this flow would be as follows -
1. File is uploaded to document library
2. Flow gets file name
3. Switch Control then cycles through cases to find equivalent partial file name (Because it's a keyword and the file names have dates, which change daily, I have to do a partial match to the file name)
4. When a case is picked up/recognised it then updates an item in my list (which also has a specific name) to the 'Completed' Status
I have attempted multiple different way of doing this, both with condition and switch controls. Preferably I'd need it to work with a switch control, I have little experience in coding myself so I've also attempted things like the array function, base64String (as per this forums suggestion https://powerusers.microsoft.com/t5/Building-Flows/How-to-specify-a-file-title-so-that-when-it-s-uploaded-the/m-p/1932883) and have been with no luck sorting this flow out.
This worked a charm perfectly
Thank you for another great solution Grant 🙂
@Hedimmer I've come up with a slightly different approach to get what you're after.
For this example, I've got the following list including keywords to cater for the RPM Production Validity, etc.
And a folder called Reports in my Documents library.
The full flow is below. I'll go into each of the actions.
When a file is created waits for a new file to be created within the Reports folder.
Get items returns all the items in the Reports List.
Select uses the output from Get items to build up an array of objects. If the file name contains an item, the Value will be set to true, otherwise it will be false. The expressions used are below. Note that we also convert the filename and keyword(s) to uppercase so we can effectively ignore the case.
//Title
item()?['Title']
//ID
item()?['ID']
//Value
contains(toUpper(triggerOutputs()?['body/{Name}']), toUpper(item()?['Keywords']))
Filter array removes any items that don't have a Value of true, so we should be left with just a single item if there was a match. The expression used is:
item()?['Value']
Condition checks to see if there is a single item in the Filter array which indicates that we got a single match. The expression used is:
length(body('Filter_array'))
If the Condition is true, we go into the Yes branch and use Update item to update our list. The expressions for the Id and Title are:
//Id
first(body('Filter_array'))?['ID']
//Title
first(body('Filter_array'))?['Title']
However (optionally), if Condition was false, we go into the No branch and Send an email informing us that a new Report was uploaded but didn't match any of the criteria.
Technically speaking it wouldn't cause a problem to do so. Because I'm trying to get it so that all I need to do is drop a file and everything else is automated however I think (in the case of being lazy when it comes to doing the reports) that changing the names would then result in a slower process than how I thought it could play out.
Also with your match the title in the list question, correct me if I'm wrong, but I'd then need to make sure the list has the exact date every time I'd want the flow to work and match. Which would mean I'm changing my list everyday to match the exact file name
"you also update the Title field of the file in the library to match your Title in your list" - This sounds like a better option, I say this with little experience, if it can be automated that is
I did have an idea come to me, what if I use a button flow in which it would literally just change the status to completed for a certain list item when pressed? Because I can add the buttons to my site and, it may not be automated, then I don't have potentially several flows all working to update an item :' )
Is there any chance you can change the file names, so they match the Title in your list? For instance, Keyword(s) - Date.
Or when you upload the files, you also update the Title field of the file in the library to match your Title in your list? That way you can have a switch on the Title of the file.
And there's no way to make it otherwise? From what I understand in what I've read - Condition controls have a limit of 10 options in power automate free, and I'd rather have it all on one flow rather than creating multiple, so because I have 11 reports I can't use a condition control to do this (or more like don't want to until it's absolutely necessary).
Also I have no idea if in future there will be more reports added, in which case I would reallly prefer the switch control to make it less clunky in it's process.
Below are all the file names.
And below is the reports tracker I have as a list
So the only one that doesn't have an obvious match is the 'Unscanned from Mill' which correlates to my RBM Production Validity on my list.
Can you show what the 11 files would be named (with sample dates) as an example?
@Hedimmer you can't use a switch here because Switch always looks for equals, not a partial match.
stampcoin
97
Michael E. Gernaey
82
Super User 2025 Season 1
David_MA
48
Super User 2025 Season 1