Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Conditional Filter Routing

spencer-reynolds
5 - Atom

Hi guys,

 

I am attempting aggregate my raw data at the Index-level based on the Securities that match each of the filter criteria. I've been attempting to build a batch macro that would iterate through each of the Index filter combinations on the fields [International], [Strategy], and [Sub-Strategy] in the raw data. I am currently able to perform all of the steps to output the data almost how I want it, except the looping through each of the Index mappings based on the varying and sometimes more complex filter combinations. If I filter the mapping table down (manually) before feeding it in to the Control Parameters, I can accurately get the values I'm looking for with the downstream process steps, I'm just unable to get over the hurdle of how to set it up to loop through all of the possible combinations.

 

For example, Index 1 consists of Securities 1, 2, 4, & 5 because they match the criteria for Index 1 in the Index Filters Mapping example I've included. Securities 4 & 5 also match the the criteria for Index 3, therefore I would like to process those records through the downstream processing in the batch macro twice, but for each individual Index.

 

I hope it is clear in the pictures, but the Orange Index column is not part of my RAW data, but in effect that's what I'm essentially trying to tack onto the raw data so that I can then aggregate dynamically through all of the Index combinations. I've also included the spreadsheet of demo data if that helps as well. Thanks!

 

data process demodata process democurrent batch macro setupcurrent batch macro setup

2 REPLIES 2
JohnJPS
15 - Aurora

HI @spencer-reynolds,

 

I think what you have is great for a known index.  You now just need to step out a level and iterate over the Index Filters table.  So you have a macro within a macro:

 

Parent (outer) Macro: just loops over the Index Filters and calls the child/inner macro.

Child (inner) Macro: loops over the data table using a filter passed in from the parent macro.

 

Hope that helps!

John

spencer-reynolds
5 - Atom

Hi @JohnJPS,

 

I actually found a similar use-case and applied the logic in the Dynamic. Batch Condition.yxzp solution on this post.

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Loop-through-multiple-conditions/td-p/...

 

I created a known index of filtering logic for each of the indices and fed that list through via a Control Parameter.

 

So for filtering each Index in my example, I fed through a field that had the following structure:

 

IndexConditional Statement
Index 1[Strategy_Code] IN (1, 2, 3)
Index 2[Strategy_Code] = 2 AND [International] = 1 AND [Sub_strategy_Code] = 27
Index 3[Strategy_Code] = 3 AND [International] = 0 AND [Sub_strategy_Code] IN (13, 10)
Index 4[Strategy_Code] = 4

 

Thanks for your input as well!

Labels