This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Could you have the macro set up with a arbitrary default. Say 2000-01-01 then have the action inside the macro check what date has been passed in. If it is the arbitrary default replace it with today's date otherwise assume the user has chosen a different date and use that?
Adam Riley Principal Software Engineer Tech Lead Core Engines, Alteryx
I do have a default setup so that there is a field for the date interface to work on.
I incorrectly assumed that without direct interaction from a user, i.e. during a scheduled run, that the date interface would default to the current day. Unfortunately it seems that it remembers the last interaction and just goes with that.
I was hoping that there was a system variable that I could check against that could tell if a workflow run was manually executed or running via schedule.
if [scheduledRun] then [date] = datetimenow() else [date] = [#1] endif
@timothycoxon Presumably you are scheduling a workflow which utilizes the macro yes? If so simply use the default date (something like above or '1970-01-01') for the value in the workflow you are scheduling and have the formula in the action look for that date as being the date when scheduled. (e.g. if ([#1] == '1970-01-01') then datetimenow() else [#1] endif) The macro would only "ask" for a date if it is executed as an "app". If someone adds the macro to their workflow, then it will start with the default date you specified on the date picker within the macro, but yes, if they then select another date, the macro will get that date. If they then save the workflow, it is the date the macro will get until someone changes it again. The idea is to schedule with the the "default" date selected and that the default is a value no one would ever select if running manually.
This is a quick screenshot of it in an actual process we have running on a regular basis.
The macro you can see on the right is the macro mentioned in the post, the interface on the left is the macros interface.
The idea basically is that when the process runs on a schedule it defaults to yesterday rather than the last saved date. Or if you manually run the process you are able choose which date you want to use.