Alteryx: How can I automatically add a field if it is not present in an incoming file??

Question ID: 109640
2
0

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 error 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?

 

Thanks!

Marked as spam
Posted by (Questions: 7, Answers: 0)
Asked on June 24, 2020 6:19 pm
2 views
Answers
2
Private 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 attached photos for an example.

Attachments:
Marked as spam
Posted by (Questions: 0, Answers: 7)
Answered on June 25, 2020 10:42 am