Hi everyone! I have created a data checks workflow that I would like to turn into a macro. The first step of this macro is to take two different files and join them, then check the output in the left, inner and right join and display a message in the log window according to what it has found.
I am not entirely sure how to proceed, do I simply use two macro input tools or is there anything else I should be aware of?
Thank you,
Damiana
Solved! Go to Solution.
Damiana,
When alteryx joins complete, there is a message in the log window like this: Info: Join (3): 9343 records were joined with 0 un-joined left records and 83 un-joined right records
You can change the name within the config window (annotate) to:
Info: Join (CHECK FOR UNJOINED RECORDS): 9343 records were joined with 0 un-joined left records and 83 un-joined right records
When I'm looking for UNJOINED records, I use a TEST tool and look for 0 count of records. This produces a RED message if it fails:
Error: Test (5): The test "unjoined right records" failed: ExpectedNumRecords==0, NumRecords(#1)==83
I'd recommend something like this for your message.
Thanks,
Mark
Hi Mark,
Thank you for making time to answer me. The issue I have is more concerned with the join itself and how I can allow the user to choose which fields to join upon. If I use two macro input tools and link them to a join tool, how do I account for the fact that the user might have different files that join on different column names?
Thank you,
Damiana
aye, there's the rub!
The simple answer is for a single join key. You would connect the macro input to a drop down interface tool and then update the value. I've not updated a join tool this way before however. When you have multiple keys, the answer requires more work.
Here is an example macro that allows a user to select the groupby field from a macro input. It is a modified record ID macro that allows you to assign text/numeric values within a grouping key:
https://gallery.alteryx.com/#!app/Record-ID-for-Groups/555c9efd398a71086464c43c
This macro might help guide you: https://gallery.alteryx.com/#!app/Advanced-Join/547f8df96ac90f0f2ca5e439