When building batch macros, you may want to use the dynamic select tool to adjust input columns. Here, I want to share some issues you may come across when doing this and the tips to address these issues.
Issue 1, indeterminable column name
Suppose we are building the following workflow, and we want to use the formula tool to perform some calculations on the selected column. We will encounter a problem because we have a changing column name, so we cannot specify a column name for the calculations.
The method I used to solve this problem is to use the union tool to fix the column name, as shown below:
where the text input tool contains the column name to be fixed. The union tool union the column name and the selected column by position and ensures that the column name is in the first row. Then the dynamic renaming tool is used to take the first row as the field name.
Issue 2, indeterminable column order when multiple columns are selected
When we fix the column name, we rely on position union to combine the column name in the text input tool with the selected column. However, when you try to select multiple columns, one problem with the dynamic select tool is that it does not allow you to customize the order of the selected columns.
For example, when we try to select the following two columns, even if we select column 1 first in the expression, it does not mean that column 1 will appear ahead of column 2. The order is based on the order in the original input data. This causes problems when we use the union tool to fix the column names by position.
To solve this problem, I just split the selection using two dynamic select tools. However, this is not ideal when the number of columns you want to select becomes larger. I think it would be nice if the dynamic select tool allows you to customize the output column order.