I would like to consider sorting the fields.
Sort fields statically
If you want to sort fields by alphabet order, you can use the Select tool.
When you click on the “Column”, “Type”, “Size”, “Rename” and “Description” on the header, fields will be sorted by clicked column value order.
For example, you click on the “Column”, columns would be sorted on Column name by descending as follows.
If you want to change the position that you want, select the fields that you want to change the position and click on the upper arrow or down arrow botton.
Dynamic sorting
The previous way is for sorting at time you make workflow. However, you might want to sort fields dynamically. In this case, you can use the Field Sort tool in the CReW Macro.
This tool setting is very easy, it is just to select the Ascending or Descending.
Note that the Field Sort tool do not accept the Blob and SpatialObj type fields. So that, if there are Blog type or SpatialObj type fields, the Field Sort tool will show the error as follows.
The cause is that this tool uses the Union tool’s select function that is explained in this blog “WeeklyAlteryxTips#43 To select fields by the Union tool instead of the Select tool“. The Union tool decide the field type depending on the first connected fileds type. And Designer shows error to connect the Blob and SpatialObj type fields to string type connected Union tool(in numeric type case, doesn’t show error). In other words, in the Field Sort tool, the Union tool is connected string type fields at first and doesn’t accept the Blob and SpatialObj type fields. For fixing that, you have to change the Field Sort macro to change the data type for header in advance appropriately. BUT, when you want to sort the fileds order, I think it would be CSV or Excel files, not Database. Furthermore the Database don’t need to change the fileds order to load them and CSV and Excel files can’t accept the Blob and SpatialObj type fields. So the Field Sort tool don’t need accept the Blob and SpatialObj type. In other words, you can simply remove them before putting the data into the Field Sort tool and the Field Sort tool doesn’t need the function that it accept the Blob and SpatialObj type fields.
Let’s back to the original topic. When there are unacceptable type fields, you have to get rid of them. The way is using Dynamic Select tool. This tool can remove them dynamically. The setting is only uncheking the Blob and SpatialObj type.
The workflow is as follows.
Conclusion
- I have explained to sort fields statically and dynamically.
- Basically, for static sort is using the Select tool and for dynamic sort is using the Field Sort tool in CReW Macro.
The next blog post is…
I would like to explain to sort by list. This is for expert.
コメント