Alteryx Designer Desktop Discussions

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

Getting File LastWriteTime Date for Macro Detour

BretCarr
10 - Fireball

Inside of a Macro, I am looking to retrieve the LastWriteTime date for a file and if it is over an hour old, it changes which path to take down a Detour tool with an action tool.

 

I know I can get that information via a Directory Tool but is there a way to do it via a formula?

 

Basically I am trying to use this to avoid a time consuming process of accessing a download token that most of the time we already have nabbed and stored in a text file. Here is the process outline:

 

  1. Check the stored token file's age from right now to the LastWriteTime.
  2. Check age of file for LastWrittenTime for great than 50 minutes old from right now:
    1. TRUE: send the process through the API process
    2. FALSE: skip the process and use the token already there

That's the entire thing. I feel like I've conquered the awful parts w/ all sorts of crazy workflow steps but this somewhat simple task is tripping me up. 😂

 

Am I using the wrong tools? Can I use the Directory tool in a Macro and impact a detour?

 

Help!

 

Humbled Bret

7 REPLIES 7
TrevorS
Alteryx Alumni (Retired)

Hello @BretCarr 

I looked into this for you and there may be a much easier way for you to go about this.

Capture.PNG

So what you can do here, is create a date-time comparison against the current time of your workflow, and the time of the document, and rather than using the detour tool, you can use the filter tool at the end to push the data either left or right based on the results!

I used the select tool to change the incoming date format to "Time" to make the comparison quicker!

I hope this helps!

TrevorS

Community Moderator
BretCarr
10 - Fireball

I think the way I'm going to go is in the same vein. I'll post back if I figure it out.

BretCarr
10 - Fireball

Thanks for the bump in a closer direction but I’m still really stumped.

 

I’ve been able get the time aspect to work no problem so thank you there for not making me have to look all that up. Kudos.

 

The problem is that path 1 has a command prompt that initiates an Oauth2.0 code/token executable and path 2 just takes the already still valid token. Your method will launch the command prompt either way which affects the underlying file, still causes the token delay in trying to avoid, and making pull out my hair which I’m losing on the daily.

 

I really want to package up this sucker in a macro for colleagues who need it. Am I missing a slick way to manipulate the XML of the detour via something other than the Action tool in combination with an interface tool?

TrevorS
Alteryx Alumni (Retired)

So there is a process I found which could work, but it'll take some tweaking on your side to fit it properly.

I used this article for the basis of the build.
https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CS-Macro-Dev-Conditional-Processing...

(Thank you @WayneWooldridge!)

The macro I attached I " think " is set up to do what you want.

The "True" column will be if the time is under 1 hour.

The "False" would be for if the token has expired.

I think this should help you to do what you need!
You may not need to use this as a macro, but supplement the process into your workflow.

I hope this helps!

Community Moderator
TrevorS
Alteryx Alumni (Retired)

Hello @BretCarr 
Just checking to see if my last post was any more help for you or not!

Community Moderator
BretCarr
10 - Fireball

Haven't gotten back into it just yet. It keeps getting pushed on my priorities. 😕

BretCarr
10 - Fireball

Circling back to let you know I still haven't forgotten about this issue. I just got to review the batch macro and it appears to be what I'm looking for!


I know the tests to run and fully understand the workflow--so I should be able to work it through. It's nice to know that my detour angle was the right side of the track! I plan on running my powershell with a wait-timer following it to then merge in the details. Should work!

Labels