Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to dynamic read a sub folder files name

richard4848
5 - Atom

Hi,

 

I have a folder which contain lots of sub folders, the sub folders are named as each month end like: 2024-06-30, 2024-05-31, 2024-04-30.

I want to find a way that can read one specific sub folder based on user's choice or prior month end. I only need the the list of file's name.

 

For now, I use Directory tool but it will read all of the files in the folder which might cost lots of time in this step, I have try to use action tool to add formular to update the directory path but it didn't work. Does anyone know any solutions about this?

 

Thank you for your help.

5 REPLIES 5
apathetichell
19 - Altair

you would use chained apps. app 1 read in directory tool - filter for name based upon your syntax. app 2 - pull up list of files you generated based on app 1 criterias. take in user selection.

richard4848
5 - Atom

Hi apathetichell, my thought was to read one variable sub folder instead of the whole folder, like <C:\Users\Desktop\box\2023-12-31> or read <C:\Users\Desktop\box\2024-01-31> the next time.

 

Directory tool must write a specific path, for this situation, I have to write <C:\Users\Desktop\box>, even I use chain apps, app1 still need to extract all files in <C:\Users\Desktop\box> and cost times.

 

 

LindonB
8 - Asteroid

Hi there,

 

Based on your desire for this to be based on the user's selection, your likely solution would be to build a macro. 

First though, I'll note that the directory tool just brings in the file names. Unless you have thousands and thousands of files, this will probably process quickly. Then you can just add a filter tool after the directory tool. It is the Dynamic Input Tool that actually hands the importing.

 

In building the macro, you'd then connect a Text Box interface tool to an action tool to the filter tool. Then configure the action tool to update the date in the filter. (Note that you could use a Date interface tool allowing users to pick a date from a calendar, but since the filter will check a directory path string, you'd need to feed it into a Text Input and converted it to a string first). Here are examples (screenshots) of how you might approach this:
323346(A).PNG

 

If this isn't efficient enough, you can instead configure the macro to change the subdirectory in the Directory Tool:
323346(B).PNG

 

Depending on your use case, you might prefer to use a Tree Interface Tool, which would permit users to select a specific subdirectory from a tree. That can feed into the Directory Tool via an Action as well. 

Hope that helps!

Qiu
21 - Polaris
21 - Polaris

@LindonB 
I was going to post the 2nd approach you did. 😁

richard4848
5 - Atom

Thank you so much, the third approach did provide a great idea, I actually can write formular inside the action tool which provide more choices for users. Just choose update value with formular so that I can update the path with formular

 

Screenshot 2024-07-16 175020.png

Labels