I am scheduling a workflow that has new daily excel files. On day 1, there are fields A, B, C and D. I aggregate on these fields in the workflow. On day two, the workflow runs again but errors out because there are only fields A and B. If any fields (in this C and D) are not present it means there is no data for that field for that day.
How can I automate this so that, even if one of these four fields is not present, every field will appear in the workflow?
Answer:
The most concise way to do this would be to use the Ensure Fields tool from the CReW Macros (available for download here: http://www.chaosreignswithin.com/p/macros.html).
This tool allows the user to put one field per line and it will check if the incoming data stream contains those fields. If it contains a field, it does nothing. If it doesn’t contain a field, then it adds that field with null values. You can also set the data type within the Ensure Fields tool.
See the below photos for an example.