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.

Iterative Macro or Batch Macro :: loop through record

Shank
8 - Asteroid

Hi All,

I'm facing a challenge with one of our use cases, and I was hoping someone could lend a hand in finding a solution. I've attempted to use the join method, but unfortunately, the results I'm obtaining are not as accurate as required.

I'm specifically seeking help with implementing an iterative macro to address this issue. The objective is to loop through Table B for every key in the data, and based on the date, extract the VAR column Data. To provide a clearer picture, let's consider an example: in Table 1, if Row 1 contains Key "A" and its allotted date is 1/1/2024, I need to loop through Table 2 and traverse all the rows to retrieve the appropriate VAR and preference information. 

 the data in Table 2 should be sorted in descending order of the end date, with preference based on the lowest to highest.

 

Your assistance and support in achieving this would be immensely valuable.

Many thanks in advance for your help and support.

 

My Data set is little, huge and i have many such combination of table 2

 

Table 1

 

RowidKeyIDAllot Date
1A1/1/2024
2A1/6/2026
3C1/3/2024
4D1/4/2024
5E1/5/2024
6F1/6/2024
7G1/7/2024
8H1/8/2024
9I1/9/2024
10J1/10/2024

 

 

Table 2

 

KeyIDStartEndperferenceVar
A1/1/20231/2/2024100AA
A1/3/20241/1/2025100AB
A1/1/20251/1/2026100AC
A1/1/199912/31/2099500AD
A1/1/199912/31/2099500AE
A1/1/199912/31/2099500AE
A1/1/202611/11/2029799AA

 

Expected Output

 

RowidKeyIDAllot DateperferenceVar
1A1/1/2024100AA
2A1/6/2026500AD
1 REPLY 1
SPetrie
13 - Pulsar

I believe a batch macro would be more appropriate in terms of a macro vs an iterative.

I think a dynamic replace is more efficient compute wise over large data sets though. (I could be wrong about that).

I have an example of both attached. In both cases, the dates need to be converted to actual date values in order to do the comparisons. Hope this helps.

Dynamic setup.PNGdynamic result.PNGbatchsetup.PNGbatchmacro.PNGBatchResult.PNG

Labels