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:
name | Qty | prd_id |
nick | 12 | 123 |
kim | 45 | 567 |
jhon | 12 | 789 |
Dataset 2:
name | Place | prd_id |
nick | LN | 123 |
kim | BGL | 567 |
jhon | TK | 789 |
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
name | Qty | prd_id |
nick | 24 | 123 |
kim | 90 | 567 |
jhon | 24 | 789 |
Exception: If the number of columns is not equal, I have to show one message that "the number of records is not equal"
Solved! Go to Solution.
Hi @Sshasnk,
The easiest way to build test is using a test tool.
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.
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.
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