Using File path Parameters

Every month I need to download a set of files from a Google Drive. The file name changes each month. Example: "Income_statement_11.30.2023". The first part of the name stays the same but the second part referring to the date, changes. How can I set up a parameter so that I don't need to change the file path every month? Thank you.

You can use a calculated parameter, for instance:

{File path} = "Income_statement_" & format(monthend(today()), "dd.MM.yyyy")

EDIT

The correct expression is below:

Can I have a "starts with" or "contains" parameter instead?
Where can I find the full list of syntaxis for parameters for me to understand the calculation you have suggested and play with variations?
Thanks

Check out these links:

Thanks, but I can't seem to get it right.
First, I get an error saying {file name} is a parameter missing in my calculated parameter.
Secondly, when using functions like Starts With or Contains, it looks like I still need to include the full file name as the first argument and that won't work because the file name changes.
Would appreciate some more help with this.
Thanks.

Should be:
{File path} = "Income_statement_" & format(monthend(today()), "MM.dd.yyyy")

1 Like

Yes, that's correct, @Jochen_Marquardt. Thanks for pointing it out.

{File name} or {File path} IS the name of the calculated parameter.

You can refer to a calculated parameter from another calculated parameter as long as it doesn't create a cyclical dependency.

See the example below.
calculated parameters.morph (1.7 KB)

Ok, I see. However, the formula of the first parameter might change from month to month unpredictably. Sometimes the date format is different. Sometimes it's just the month's name, sometimes it's the last day of the month. How can I just set the file path as a Startswith condition?

I'm trying to understand your case because it looks like I misunderstood you. So you don't need a precalculated file name, but the first file name (in some particular folder) that starts with a certain text string, is that correct?

Yes. I just need EasyMorph to download from the Drive the file whose name starts with "income_statement" or that contains the word "income" in it. Every month a new file will be uploaded to the Drive which will have those conditions in its name. But the name will also contain the date in a format that can vary. I hope this clarifies.

Got it. In this case, you don't need parameters at all. Instead, use the "Load list of files" mode, where your list will contain just 1 file. The workflow will be as follows:

  • Generate a list of files in the target folder
  • Use filters (e.g. "Filter by condition") to keep only the necessary file
  • Load that file in the "Load list of files" mode

See this tutorial article, section "Advanced topics: loading list of files": EasyMorph | Loading one or many files

Thanks, Dmitry. This looks like it could work. However, I'm encountering an error. Generated the file list, and applied the filter, but when downloading the list of files the system couldn't find the file. Which is weird since it previously found it when listing the files in the folder.

Make sure you use full file paths. Because currently you use only the file name without the path.

1 Like

Hi Dmitry, I'm still struggling with this. I could successfully download the files using the List files command + filtering with a Contains string. However, when I want to load the file into a project I find myself in the same situation since the file to load's name changes every time.

I understand that I should be able to create a calculated parameter defining a string of text that the file name will always include, but I can't seem to get it right.

As you can see in the first image, I first used to folder path parameter. Then created a File name parameter using the folder path parameter &"\string*". I understood from a previous post here in the community that by using a * at the end of the string I could shorten it, but didn't work (error in the second image).

Please help, I haven't found a tutorial or a post clearly explaining this specific case.


You can also load (import) files as a list, not just download. The tutorial link I posted above explains this very clearly.