It's possible to include variable in the file path?

Hello!

Using automation, I save a pdf file on drive, using a structure with multiple folders: default path + year extracted from a date field. On the other side, I have a File column where the name of the file is made from variables (ID, name); I need to be able to exactly the place of the file, because, being save in the year folder, so it’s not found anymore.

Example: my default path: data/myApp/myFolder, then in my automation, I set another folder: “ssm”, and this folder contains “year”, so the entire path is: data/myApp/myFolder/ssm/year. And “year” is obtain using year([date_column]).

I don’t know how should I write the expression in the File column, to integrate the year, I have only this:

Concatenate(“/data/MyApp/Myfolder/SSM/”, [ID],“_”,[name],“.pdf”)

Thank you for your help!

Regards!

Ruxandra

1 Like

Hello @Ruxandra , Yes! you can include variables in the file path.

In my case, I usually start a folder path from the default path. For example, if you set your default path as

you can write the expression in the File column like this

CONCATENATE("SSM/", YEAR([date_column]), "/", [ID], "_", [name], ".pdf")

This expression will create an SSM folder inside myFolder, which is the default folder. Then, in your table, the path will be saved something like this:

SSM/2024/12345_MyFile.pdf
1 Like

If I understood your case properly, yes it possible to use varisble as it just save the path as a string. Just read the year in the same to your file path after the ..SSM/

1 Like

Hello!

Thank you for your answer. Could you please help me by giving me more details, the year is extracted from a field using Year() function, how could I use this in my string : Concatenate(“/data/MyApp/Myfolder/SSM/”, [ID],“_”,[name],“.pdf”); because I tried and it concatenates the year to the name of the file and on the other side, I don’t want to put the year in the name of the file.

What I mean is I want to keep the name of the file as it is (id+name), but all the files created in a year should be saved on a path having the final folder that year.

Thank you very much!

Regards!

Ruxandra

Many thanks, Alirio, it works very well.

Regards!

Ruxandra

2 Likes