community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Dynamically select input columns

Highlighted
Meteoroid

Dear friends,

Dynamically Select Date Columns.jpgDynamically Select ColumnsI want to schedule a workflow and dynamically select columns (the column headers are the last Sunday of the week). I want to run the workflow on Monday and it should fetch the data for the next week, below is my example

 

For example - i run the workflow on coming Monday i.e 7th Jan, it should select the column header 12th Jan and drop all the remaining columns, I then can use this column ahead for my transformation. Can you please suggest the way to do this? 

 

Thanking you,

Rajat

Alteryx
Alteryx

Hi @rajatsaxena0707

 

OK, you may have to bear with me a little bit on this one, not sure it's the most simple, but it will work.

 

I have attached the workflow, the dynamic select is the part you want, I left the formula in there so you can see my working....

 

DateSelect.png

 

First I needed to get the week number - DateTimeFormat(DateTimeToday(),"%W")

Then I needed to times this by 7 and add this onto the first Sunday in 2019 - DateTimeAdd("2019-01-05",ToNumber([Week])*7,"days")

Lastly I then needed the date format to match that of your columns - Trim(DateTimeFormat([Date],"%d-%b"),"0")

 

Once I had achieved the output I rolled them all into one formula and that is what I used in the Dynamic Select:

 

[Name] = Trim(DateTimeFormat(DateTimeAdd("2019-01-05",ToNumber(DateTimeFormat(DateTimeToday(),"%W"))*7,"days"),"%d-%b"),"0")
Meteoroid

Hi @JoeS

 

Thank you so much for providing the solution.. I was trying to accomplish this but in a different way and made it more complicated than it should have been; Your solution worked perfectly fine, thank you.

 

Best,

Rajat

Alteryx
Alteryx

@rajatsaxena0707 you're welcome. I did quickly check a few random Monday's in the future, I think the time it may fall down/need updating is the start of 2020.

Labels