Alteryx Designer Desktop Discussions

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

Need a loop to compare multiple fields

saibal_78
8 - Asteroid

Hi All,

 

I have a dataset as shown below where I have columns like "Doc ID", "Item No", "Item Name" and "Country". In this dataset Doc ID field is repeated and each Doc ID has different Item No. Now I want to match the country against each Items No against a particular Doc ID and give us result as mentioned below

 

"If Country against each Item No for a particular Doc ID matches then print comment as "passed" else "failed"

 

Input Dataset

 

Doc IDItem NoItem NameCountry
100011XXUS
100012XYUS
100013YYUS
100014XXUS
100015YYNL
100021ZZCA
100022ZXCA
100023ZYUS
    

 

Output Dataset

 

Output.JPG

 

I have created a simple workflow (attached) which caters to my requirement but the issue here is "Item No" field is not fixed, in the above dataset Item No for first Doc ID has 5 line items but tomorrow I may have 10 Item No against it  or against any other Doc ID, in that case my simple workflow wouldn't consider additional Item No for comparison since its not dynamic.

 

Incorrect Output

 

Incorrect Output.JPG

 I feel I need to have a loop here which will take the max number of Item No and keep comparing the country field till the time it reaches last Item No

 

Any help will be highly appreciated

 

Thanks

4 REPLIES 4
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @saibal_78,

 

Is this what you're looking to achieve?

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

saibal_78
8 - Asteroid

Thanks a lot, it works fine, I am just checking if it works fine if there is any blank in Country field, I want blank country also to reflect as "failed", otherwise it works perfectly fine.

saibal_78
8 - Asteroid

Below scenario should be failed but its passing the criteria which is not correct

 

Capture.JPG

saibal_78
8 - Asteroid

I Somehow resolved this

Labels