Alteryx Designer Desktop Discussions

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

dynamically search dataset depending on input from second file

Y_B
6 - Meteoroid

Hi everyone,

 

I'm new to Alteryx and seek some advise on the following issue. I want to search a dataset dynamically depending on input from a second file or a third file (or more).

Example: 

Dataset

NumerationProductFVM LEVEL
1Bond1
2Bond1
3Derivative receivable3
4Derivative receivable2

 

second file

NameDecision_VariableContains
DerivativeProductDeriv

 

third file

NameDecision_VariableContains
Level 1FVM LEVEL1

 

Second and third file are 2 sheets from the same excel workbook and I know how to run through via macro. The following dynamic search should be included in said macro.

In this example, when the second file is "active", I would like the workflow to search in field [Product] (Decision_Variable of second file) of the dataset for entries that contain "Deriv". A new field [Cluster] should be added to the dataset that contains "Derivative" ([Name] second file), if cell in the same row and column [Product] contains "Deriv".

When the third file is "active" the workflow should search in field [FVM Level] (Decision_Variable of thrid file) of the dataset for entries that contain 1. If found add "Level 1" to new column [Cluster].

 

Result from first second file:

NumerationProductFVM LEVELCluster
1Bond1 
2Bond1 
3Derivative receivable3Derivative
4Derivative receivable2Derivative

 

Result from third file:

NumerationProductFVM LEVELCluster
1Bond1Level 1
2Bond1Level 1
3Derivative receivable3 
4Derivative receivable2 

 

 

I have tried to solve this by appending second/third file with the Append Fields tool as new columns to the dataset and creating column "cluster" with an if statement in a formula tool, but how to address the columns in the dataset dynamically depending on the Decision_Variable.

Thanks for you help in advance,

Y_B

8 REPLIES 8
Amol_Telore
11 - Bolide

Hey @Y_B 

 

Here is my solution. Hope this what you are looking for.

 

Amol_Telore_0-1658478599555.png

 

ArtApa
Alteryx
Alteryx

Hi @Y_B - Here is how you can do this. Pink containers are identical, but Right Inputs are different. Therefore they give different results, as per your request:

ArtApa_0-1658554820794.png

 

Y_B
6 - Meteoroid

Thanks for your replies!

@ArtApa The second formula tool you used in each of the container would need manual adjustments if I were to change e.g. cluster names. So I went with @Amol_Telore solution.

 

Using this flow with a bigger dataset has led me to an issue that I'll explain with the following example:

Assume second and third files as before and the following change to the dataset:

NumerationProductFVM LEVEL
1Bond1
2Bond1
3Derivative receivable1
4Derivative receivable2

Now #3 would have two Clusters, Derivative and Level 1. Problem is that I only want to have one cluster and that should be the cluster that is defined "first", which means in this case it would be the one from the second file (if I had 4 files and 2 Clusters from third and forth file were assigned, it would be the cluster from the third file).

In @Amol_Telore solution the last cross tab is listing the cluster names alphabetically (correct me if I'm wrong). 

Y_B
6 - Meteoroid

Solved above by adding 1_ , 2_ etc. to cluster names.

In a last stepp I am trying to remove those prefixes with the regex tool. I tried regular expressions ^(.*?)_ and ([^_]*).*. The last one gives back the prefix only. What would be the correct expression here?

 

Thank you,

Y_B

Amol_Telore
11 - Bolide

Hey @Y_B 

 

I have modified the workflow a bit to take only first cluster for each group based on first come first serve basis. PFA workflow for your reference. Hope this solves your last concern as well.

 

Regards,

Amol Telore

Y_B
6 - Meteoroid

Hi,

Y_B_0-1658839383958.png

 

This is the output for the changed dataset (input) from above. As you can see there are 2 clusters. Did you maybe accidentally upload the old workflow?

 

Best regards,

Y_B

 

 

Amol_Telore
11 - Bolide

Hey @Y_B 

 

My bad. While uploading it to the portal I choose older flow. PFA new process. 

 

Regards,

Amol Telore

Y_B
6 - Meteoroid

Thank you very much

Labels