Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to check number of rows are equal in both the dataset

Sshasnk
8 - Asteroid

So I have two datasets and I have to check if the number of rows in both the dataset are equal or not.

 

Example:

Dataset 1:

nameQtyprd_id
nick12

123

kim45567
jhon12789

 

Dataset 2: 

namePlaceprd_id
nickLN

123

kimBGL567
jhonTK789

 

Condition:

1. Check if both have an equal number of rows, In the above example we have an equal number of rows

2. If the number of rows is equal then multiply the QTY column by 2 and below will be our output

 

nameQtyprd_id
nick24

123

kim90567
jhon24789

 

Exception: If the number of columns is not equal, I have to show one message that "the number of records is not equal"

2 REPLIES 2
Emil_Kos
17 - Castor
17 - Castor

Hi @Sshasnk,


The easiest way to build test is using a test tool.

 

Emil_Kos_1-1613637112214.png

 

I don't think you can get a message with information using this solution thought. You will get an error with information that the test "the number of records is not equal throws the error".

 

I believe it should be sufficient for you.

 

 

AngelosPachis
16 - Nebula

Hi @Sshasnk ,

 

Not sure if this is the most straight forward answer and I look forward to what others have to suggest, maybe there is a more robust solution.

 

What this workflow does is counting the number of records from both inputs, then brings those counts side by side with a join and uses a filter tool to check if the records are equal. 

 

If not, you will have values coming out of the F output anchor, and that will trigger the message tool to throw an error saying that the number of records is not equal.

AngelosPachis_1-1613638245746.png

 

If the number of records is equal between the two inputs, then you somehow want to bring the data from the first input and multiply the quantity by 2. The most challenging part was that you want to run this part of the workflow only if the records are equal, so I have done that with another filter tool.

 

Interesting question, look forward to see what others have to suggest

 

Hope that helps,

 

Angelos

Labels
Top Solution Authors