Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
mathieuf
Alteryx
Alteryx

Our objective is to compare two tables with the same structure before putting the process into production (an Alteryx workflow for example) that feeds the new table to replace the old one.

 

To illustrate this use case, I will use the following two tables:

 

Production table:

 

mathieuf_0-1646216203632.png

 

It is important to have a unique identifier in both tables. If you don't have one you can create one with the Record ID tool.

 

Dev table:

 

mathieuf_1-1646216203646.png

 

The elements highlighted in yellow are the elements that are not identical to the production table.

 

Preparation with Designer

 

I use two tables from my SQL Server database in this demonstration:

 

mathieuf_0-1646216726365.png

 

I then tag the two environments with a Formula:

 

mathieuf_1-1646216777988.png

 

This will allow me to identify the source of the data.


And with a Union to follow, here we are:


 

mathieuf_4-1646216203659.png

 

 

The data structure is as follows (Prod and Dev data have been stacked):

 

mathieuf_5-1646216203677.png

 

 

The magic pivot

 

A - The theory

 

To understand this step, here is a diagram of the data structure before and after.


The input data...

mathieuf_6-1646216203800.png

 

...can be summarized as follows:

 

mathieuf_0-1646217042610.png

 

 

And the expected output data...

 

mathieuf_8-1646216203647.png

 

 

... follow the pattern below:

 

mathieuf_1-1646217098127.png

 


B - Let's do it now!

 

In practice, we need two tools: Transpose and Cross Tab

 

mathieuf_10-1646216203894.png

 

We set the ID and environment to rotate the rest of the data as follows:

 

mathieuf_2-1646217216250.png

 

Our data has this structure now:

 

mathieuf_12-1646216203673.png

 

For the pivot table, we keep ID and Name as columns.

 

The environments (Dev and Prod) will be used as headers while the values (in the value column) will feed the heart of the table:

 

mathieuf_3-1646217291886.png

 

Setting up the control

 

A sorting of the data for more clarity and a filter checking if the Dev data are equivalent to the Prod data and that's it!

mathieuf_4-1646217400814.png

 

This gives you the data without regressions (T output) and the errors (F output).

 

A self-service application ?

 

Why not share this workflow freely on Server?

 

Each user (whether they use Alteryx Designer or not) could then do their own non-regression tests.


Think of the developers who change a business rule in a flow, what about the business users who have to validate the consolidation? The use cases are numerous.


 

Analytic App transformation

 

The first step is to transform this workflow into an analytical application to enable interaction.

 

We add two Text Box tools:

mathieuf_5-1646217706319.png

 

 

The Action tool updates the name of the database table:

 

mathieuf_6-1646217765100.png

 

 

Now on the Server

 

Once published, the application can be placed in a District. Mine is called Self Service by IT.


 

mathieuf_17-1646216203650.png

 

The public application is executable by all:

 

mathieuf_18-1646216203922.png

 

When launching, I can choose the tables to compare:

 

mathieuf_7-1646217897335.png

 

And see the gaps on the Gallery:

 

mathieuf_20-1646216203660.png

 

This should help you validate the compliance of your data and also enrich the services your Gallery offers.


The workflow is attached.