Iterative Macro not working - Adding +1 with loops
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
Thanks!
Solved! Go to Solution.
- Labels:
- Iterative Macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I believe the issue is that you are overwriting the value every time with [field3], the original one and not the updated one.
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
Hope this helps. Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
As for the "," I believe this is because the field is a number, you can convert it to a string if need be.
Hope this was helpful 🙂 Cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!!
