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.
We like to play games at Alteryx and actually use the software quite often to organize, create, and execute these games.
Upon creating a BINGO game, I came across a technique that I thought could be useful in "real world" scenarios for users who are attempting to iterate a process and then replenishing the data after a certain amount of time.
So how exactly does this work and how is this useful?
The use case:
Create a workflow that will run every ten minutes producing a random number, then eliminating that number after use, then replenishing the same file at 5PM to start the game over the next day.
It would be easy to just create two workflows for this, but I didn't want to do that in case I needed to troubleshoot, add, or reschedule. Plus, I wanted to saves space on the server!
So how do we accomplish this?
There are two factors that I need to consider:
1) How do I get two different workflows to execute in one workflow?
2) How do I get the two workflows to execute at different times?
1) Tool Containers: If you are only using Tool Containers to document your workflows or to disable section of them for development, then you are missing a very powerful use for this tool! You can use the tool to disable section of the workflow in production to run certain sections of a workflow, but using a combination of the Tool Container, Action, Control Parameter tools to create a batch macro. Wait! Why are we building a batch macro? Technically we are, but the use is really for one batch per run, so we can utilize the enable and disable of the tool container.
In the end, the Random Number Tool Container will stay open until 5PM, continuously updating the numbers.yxdb file which is being read in with the Macro Input tool and sent with updated information in the Output Data tool and being read back in every 10 minutes.
Once 5 PM hits, the Random Number container closes and the Replenish File container runs once at 5:10 PM, which is the time I have the workflow set to stop.
Cool! That works, but this is a macro. How do we use the macro and how do we feed the time to the tool containers?
2) In each of the Action tools we have the value selected at the top and each has their own expression that is opposite of each other.
[#1] is the data coming in to the Action tool from the Control Parameter, so we need to make [#1] the current time, so it knows when to open and close containers in the formula's above.
Since we have created a batch macro, we only want the macro to run once per run and not really 'batch' more than once. To do this, we will want to use the same time for all of the data being pushed into the tool.
In the end, I will schedule this workflow to run every 10 minutes until 5:10 PM. In each run, the workflow will take the exact time and place it in the macro with the updated data. Before 5 PM, the workflow will keep the Random Number Tool Container open and choose a random number from the data, remove that number from the data, and update the file. After 5 PM, the workflow will run one more time and replenish the numbers file with the original set of numbers.
Note, You will see in the screenshots that I have an Email address file, I am actually sending out the random numbers to team members emails. I did not include this in the discussion, but the setup is included in the workflows attached if you would like to try. Plus I added the cards!!!!!