Alteryx Designer Discussions

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

Iterative Macro not working - Adding +1 with loops

Joker_Hazard
8 - Asteroid

Hi guys.

I'm having a little bit of trouble regarding my workflow. My macro is not working properly..

- I need to add +1 on "field 3" as many times as the user decides. However, on the second image, you can see that the macro is running with an infinite number of times and its not adding "+1". How can I correct that?

Joker_Hazard_0-1609260245553.png

 

Joker_Hazard_1-1609260394418.png


Thanks!

5 REPLIES 5

Hi @Joker_Hazard 

 

I believe the issue is that you are overwriting the value every time with [field3], the original one and not the updated one.

 

christine_assaad_0-1609262766054.png

I tweaked your macro a bit so the numeric up down is controlling the number of iterations and the new iterations are fed with the updated value of field 3

christine_assaad_1-1609262838488.png

Hope this helps. Cheers!

Joker_Hazard
8 - Asteroid

Hey Christine, thank you so much!!

Is there a way to make Field 3 to have "zeros" before the numbers? I need it to be 000001, 000002.. etc.

Also, why is the other fields with commas?

Joker_Hazard_0-1609263273369.png

 

Hey @Joker_Hazard 

 

You can use Multi-field formula to padleft the values with zeroes at the very end of your process like in the below screenshot.

 

christine_assaad_0-1609263698732.png

 

As for the "," I believe this is because the field is a number, you can convert it to a string if need be.

christine_assaad_1-1609263786026.png

 

Hope this was helpful 🙂 Cheers!

mutama
Alteryx
Alteryx

Hi @Joker_Hazard ,

 

For [Field_3], after the Iterative Macro produces the output as shown in @christine_assaad ’s solution, try using the “Formula” tool as the next step, and apply the following expression to update [Field_3]:

 

IF [Field_3] <= 9 THEN

“00000” + ToString([Field_3])

 

ELSEIF [Field_3] >=10 AND <99 THEN

“0000” + ToString([Field_3])

 

ELSEIF [Field_3] >=100 AND <999 THEN

“000” + ToString([Field_3])

 

ELSEIF [Field_3] >=1000 AND <9999 THEN

“00” + ToString([Field_3])

 

ELSEIF [Field_3] >=10000 AND <99999 THEN

“0” + ToString([Field_3])

 

ELSE ToString([Field_3])

 

ENDIF

 


As to why you are seeing the comma separators in Field_2, may I check that you are using version 2020.4? In this version release, there are 2 new settings that you can customize to change how numbers display in Designer: Thousand Separator and Decimal Symbol. These settings affect how numbers display on the Designer canvas, the Results window, and the Browse tool Data Profiling. The default settings depend on the language that you select for the Designer interface, but you can always update the defaults. Visit here for more details: https://help.alteryx.com/current/designer/user-settings#localization

 

Hope this helps!

 

Joker_Hazard
8 - Asteroid

Thanks Mutama and Chris... You guys have my gratitude! Made my day

I was able to fix both issues, thanks again.

Have a great New Year's!!

Labels