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.
SOLVED

[Iterative Macro] Not working to update numeric values

Joker_Hazard
11 - Bolide

Hello guys.

I am trying to create a macro which would update a numeric field everytime I runs the script. However there is a problem:

Joker_Hazard_0-1608830144100.png


Yep, it is updating, but I ran the script 10 times and it does not go higher... 873204 -> 873205 -> etc.

I need it to update and save the updated value, to use it in the formula..

Is there a way of doing that? 

thanks!

11 REPLIES 11
AngelosPachis
16 - Nebula

Hi @Joker_Hazard ,

 

What's the reason you are using a numeric updown tool in the macro's interface? What do you want to achieve with this? Allow the user to add a custom interval to Field 1, so instead of Field1+1 you could have Field1+ x , where x the value given by the user?

Joker_Hazard
11 - Bolide

Hey,

I think is not necessary to have it... My purpose is to update the value automatically, therefore, the user would take no action... 

Still, I'm no able to achieve that. Any ideas?


AngelosPachis
16 - Nebula

@Joker_Hazard 

Oh, alright, so every time the workflow runs, you would like to get the value in Field 1 + 1, correct?

 

The reason you are only seeing 873203 is because your macro is not iterating, it just gets the original value (873202) and adds 1. Because the input is not updated every time the workflow runs, you're constantly getting the same result

Joker_Hazard
11 - Bolide

Yep, Exactly. 

The only rule is to never repeat the number, so everytime it runs, adds +1.

AngelosPachis
16 - Nebula

To make this an iterative macro, you should create a condition that will stop the macro from iterating (i.e. you can allow your user to define an end value (873210) and your macro will run until it reaches that value.

 

Would that work in your instance?

 

AngelosPachis
16 - Nebula

So @Joker_Hazard ,

 

I've converted that into an iterative macro, which allows the user to give a maximum number (in this example 873208) and the macro will run until it reaches that number. So you will get every row from 873202 to 873208.

 

Untitled.png

 

Would that work, or would you prefer the user to manually have to click on run to see what's going on in each iteration?

Joker_Hazard
11 - Bolide

That would work, if the files are saved in a directory.

My idea was much simpler.

Run script -> Value is updated -> File is saved.

Just to let you know, the file would be later consumed by a program, and this program does not recognize values that have already been read.

Does this makes sense to you?

Joker_Hazard
11 - Bolide

Thats excellent! Can you please send me the macro? I would like to study that...

Thank you!

AngelosPachis
16 - Nebula

I'm trying to keep up @Joker_Hazard , but my question is, if you want to run the script 50 times, maybe it would have been better if you don't have to click on run button 50 times?

 

Not sure what the program requirements are, but does it have to read files in a directory which  only contain a single row of data?

Labels