This week’s tips is a subsequent of last week’s one. I would like to explore the task assignment problem deeper.
This week’s challenge
At the last post, the task list have no specified date, however we consider that the task list have execution date at this post.
This is last week’s task list.
This one is this week’s task list.
In this case, we need to make a macro in order to join by the record order. However, don’t worry, it is very simple! When you want to make a macro, make the simple workflow like processing one day’s data and then you macronize it. For example, consider to assign the tasks of the April 1st’s tasks.
This is original workflow.
In this case, you need to add the Filter tool between the Task list and Join tool and set the Filter tool to filter the April 1st. This allows you execute the assignment of the April 1st data.
If you change the filtered date, you can get the another date data. This means that for each eligible dates, you change the filtered date and join them by the record position, you can get the needed data. To make such a workflow, you have to make following batch macro.
For making this, you need to change the input/output to macro input/output and add the Control Parameter tool and set it to rewriting the date by the Action tool. In this case, the Control Parameter tool receive the date list. The Action tool’s setting is as follows.
However, you might want to know which dates are the remaining resources. For that, add the Formula tool between the Join tool and R output and connect the Control Parameter to its Q input.
This Formula tools make a new column. You can use the data from the Control Parameter output directly, so you can connect the Control Parameter tool output to the Q input of the Formula tool. The setting of the Formula tool is as follows.
When you want to use the Q input data in the Formula tool, you can use the connection name for it. On the other words, you can access the data through the connection name. However, when you use the connection name, its data is null at the debug. This is a point to note. When you want to use it for the calculation, it is difficult to confirm the result of the calculation since the data is null while you are debugging. I only recommend using Q input when you want to use the data directly. But the using connection name(use Q input) is very simple way.
Let’s get back to our topic. For using this macro, it should be making this workflow.
The important point is to input the unique dates to the Control Parameter input. For that, you can use the Summarize tool to group the dates.
Bonus
To be the honest, you don’t need the batch macro for this case. But such a workflow is a bit complex. I added some sample workflow. I would like to share the overview of the workflow in this post.
The sample workflow is :
- Append the task ID for each task
- For the resource list, create resources for each target date
- Join the data by task ID and Date
Conclusion
This post is about assignment of the resources. The previous post was very simple pattern, so you could use to join by record position. But if the problem become more complex, you need to create a macro or more complex workflow using join the key column.
When the problem is complex, you can solve them by breaking them down into component parts.
Sample workflow download
Contents of the next blog
The next post will be about “Random” in Alteryx.
コメント