cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KimP
Helper I
Helper I

Dynamically filter and name files

Hey,

 

I have a flow that I created to sync files between OneDrive for Business and specific SharePoint site/folder.

This flow is working for its original intended purpose. (screenshot below)

I would like to extend the functionality to deal with file names that are not static as well as creating output file names that can be created dynamically using a mask e.g. _yyyyMMdd on the end of a file name.

 

hG910YN4cs.png

 

To control this currently, I use a simple SharePoint list that looks like this...

The red box is the current working setup. The green box is the next iteration I'd like to get to.

 

jpbKOsHlha.png

In the 'FileName' (for reference, it is actually called 'Title' as far as SharePoint is concerned), there is the new entry for 

 

AuditTrail-Timesheet-*.csv

 

 

 

The files in OneDrive are actually called something like

 

AuditTrail-Timesheet-kimp-20211009002515.csv

 

 

I would like to use the '*' as a wildcard in the 'Filter Query'.

Based on my reading, I understand true wildcards or Regex isn't possible but I'd like to recreate that functionality somehow. I understand I can do starts with or ends with, not sure if contains is an option? Could I do both starts with and ends with?

Based on the current setup it obviously says 

 

Title eq 'vFileName'

 

which I need to change to the functionality I want to achieve. 

 

Secondly, and I'm happy to create a separate post for this if that is more appropriate, I'd like to be able to define the 'NewFileName' based on a static value, followed by a mask of some kind or, a mask of some kind, followed by a static value (not necessarily just a date, although that is the most likely use case), so, in this example, the output would be...

 

AuditTrail-Timesheet_20211013.csv

 

 

Let's assume for now that the date would be based on the file created date time.

 

I have complete control over the SharePoint list so if changing the '*' or the [yyyyMMdd] to something else makes this easier to solve, then I'm fine with that.

 

Hopefully this is enough detail to go on. I appreciate your help.

 

Thanks,

Kim

 

1 ACCEPTED SOLUTION

Accepted Solutions
powercorner
Responsive Resident
Responsive Resident

Hey @KimP 

I am not sure if I understood your problem right, but wouldnt a "startswith" & "endswith" inside your filter query help you out? Then you could say that your Title starts with & ends with a certain string. eg. 

 

startswith(Title,'AuditTrail-Timesheet_') and endwith(Title,'.csv')

 

Source: Funktionen „EndsWith“ und „StartsWith“ in Power Apps - Power Apps | Microsoft Docs+

 

Maybe I understood you wrong, but if you like to filter it inside the query this should be the approach?

 

With regards

Kevin

View solution in original post

5 REPLIES 5
powercorner
Responsive Resident
Responsive Resident

Hey @KimP 

I am not sure if I understood your problem right, but wouldnt a "startswith" & "endswith" inside your filter query help you out? Then you could say that your Title starts with & ends with a certain string. eg. 

 

startswith(Title,'AuditTrail-Timesheet_') and endwith(Title,'.csv')

 

Source: Funktionen „EndsWith“ und „StartsWith“ in Power Apps - Power Apps | Microsoft Docs+

 

Maybe I understood you wrong, but if you like to filter it inside the query this should be the approach?

 

With regards

Kevin

Hey @powercorner,

 

Thanks for the reply. I think if I create two variables, splitting the text at the separator, so I end up with a string for file start and file end variable then this is workable.

 

Do you have any ideas on the second issue? The NewFileName created dynamically?

 

Thanks,

Kim

powercorner
Responsive Resident
Responsive Resident

Hello @KimP ,

 

It would be better to split your questions, cause its hard to help you with two questions in one topic. In addition the people who will read this in future would not understand which solution is for which question, cause you are only allowed to accept one solution. 


I would suggest that you accept the first solution and creates a second thread in order to answer your second question. Maybe you could describe your problem more in detail, cause I couldnt understand it from the last post, sorry 😞

 

With regards
Kevin

powercorner
Responsive Resident
Responsive Resident

@KimP 
Could you accept the answer as solution, then this post can be closed.

 

Thank you

Kevin

Hi Kevin (@powercorner),

 

My apologies, I'm not getting notifications for some reason and missed this.

Been dragged onto a number of other projects and not spent any time on this.

I'll post part 2 of my question when I get back to this.

 

Thanks again,

Kim

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,515)