We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

Alteryx Designer Discussions

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

iterative macro

9 - Comet

Hi Team,


I'm trying to create iterative macro for the following data-set 


Expected output:


1)If level in increase then outut column add one value after first level.
 (QuesDefn Object= 'Question' then output of 1st row is '00001', 
  If QuesDefn=option then check level,If level =2 then Output is 00001.00001 OR if Level=3 then output is 00001.00001.00002)
  Note : Level 2 consider 2 values, as like 3 Level considered 3 values.
2)If QuesDefn Index id changed and considering level=2 then
 output for same 'QuesDefn Id' = 00001.00002 OR if level=3 then 00001.00002.00001
 Note: This problem is regarding Questions and responses of program.
       So,Question consider 'RadioButton' and option consider 'MultiCheckbox'
	   Each 'RadioButton' consist Unique value  of 'QuesDefn index' and 'QuesDefn ID' also Each 'MultiCheckbox' consist unique valus of 'QuesDefn Index'


Data (1).png





Hi @BRRLL99,


I don't fully get where the values 5 and 6 for the first level are coming from, so I simply started counting from 1 in my solution.


I have not create an iterative macro, if you have more level than 3 it may sense to work with a macro. But in my opinion it could be a batch macro as well.


At the beginning I am calculating the element numbers.


This is the part where I would say you could use a batch or iterative macro if you want.


After this is done I simply fill up the missing lines where required  and combine the fields.


Hope this helps.


Best regards,