We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Directory Input Question

KateC
8 - Asteroid

Hi,

 

I am trying to use Directory Input to pull in an Excel file each month. The filenames are consistent and I'm familiar with how to pull the most recent file in the directory. However, this time, I want the 2nd file in the directory. Not the most recent, but the one before that. Using my normal Directory Tool > Sort > Sample > Dynamic Input doesn't seem to be the way to go. I've got Sample set to skip the first 1 rows but that only works right now because there are 2 files in the directory. Any suggestions? Thanks!  

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @KateC 

 

Just use select record tool to get only the 2nd row like below

 

atcodedog05_0-1644334831938.png

 

Hope this helps : )

 

JaeLim
Alteryx Alumni (Retired)

Hi @KateC .

A quick method I can think of is by using a combination of 2 sample tools:
1. 1st sample tool to skip the 1st row (what you are already doing)
2. 2nd sample tool to choose the 1st row

This way you will always be selecting the 2nd row/ file, no matter how many files there are in the directory. 

If you need a more dynamic approach, perhaps you can consider using "wildcard * names". 

SoccerTil
8 - Asteroid

Perhaps what you're missing is to sort the directory file list by Creation Time, Descending. First. Then Select Records the second record.

KateC
8 - Asteroid

That's great! I just took out the Sample and replaced with Select Record. Works perfectly. Thank you

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @KateC 

Cheers and have a nice day!

ChrisTX
16 - Nebula
16 - Nebula

If your Directory listing has only one file, do you want to keep that file?  Does your selected solution work with only one file?

 

These tools keep the send record, or the first record if there is only one:

 

ChrisTX_0-1644341075794.png

 

 

Chris

Labels
Top Solution Authors