Start Free Trial

Alteryx Designer Desktop Discussions

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

how to do a for like this in alteryx?

danBrow
5 - Atom

how to do a for like this?

 

var text = "";
var i;
for (i = 0; i < 5; i++) {
text += "row:" + i + "<br>";
}

 

IMPORTANT 1: i want to know how to do it with a macro.

 

IMPORTANT 2: in less than 5 minutes

 

Thanks

 

1 REPLY 1
KaneG
Alteryx Alumni (Retired)

Hi @danBrow

 

In order to do this using a macro, you're looking at a batch macro. Your Control Parameter will be your i values. In the below screenshot, I have used a generate rows to simulate closer to what you have written.

KaneG_0-1607568011607.png

 

The Batch Macro is pretty simple inside. It uses a Text input to create the [Text] field with enough characters and then a formula to create the text.

KaneG_1-1607568082672.png

 

Note the action tool configuration replacing the right part of the string

KaneG_2-1607568182943.png

 

I've attached the workflow that the above screenshots came from. I understand that you wanted to do this in a Macro, and maybe it's because your example is a lot more complicated, but this exact example, could have been done with just a formula. Either way, it's a simple example to learn about Batch Macros!

Labels
Top Solution Authors