Alteryx Designer Desktop Discussions

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

Batch Macro - IF formula

Miko007
5 - Atom

Hi everyone,
I have this simple batch macro and I'm trying to replace string value that I used in formula tool while creating an If statement. Every time I'm trying to change formula in "replace a specific string" window and limit it only to the string that I want to replace, the "replace a specific string" window goes back to the original set up (displays the whole formula again). Could anyone have a look and help me out?
Best, Miko

Miko007_0-1666221617497.png

 

5 REPLIES 5
Qiu
20 - Arcturus
20 - Arcturus

@Miko007 
Would it be possible for you to upload this macro?

Thomas_Wells_2dot0
8 - Asteroid

Hello @Miko007 

I recently created a simple Analytic App which updates a Filter tool, based on "List Box". I too used the Action tool to configure this update using the "Update Value (Default)" setting. 

 

The formula in my filter tool that is being updated by the Analytic App is "[PLAN] IN ("selected")"  .... See Image #1. 

Then in the Action tool above the filer, I'm using "Replace a specific string" but I'm only telling it to replace "selected" ... See Image #2.

Basically the phrase "selected" is a place holder that is updated by the user input in the Analytic App.  

 

Instead of replacing the entire IF formula in your Action tool, can you just specify 'Wolves' since that's the string you need to replace? If that still doesn't work, if you could upload a sample of your macro, that would be helpful for troubleshooting. Thanks 

 

 Image #1 

2022-10-19_21-24-13.png

 

 

Image #2

2022-10-19_21-25-222.png

 

 

 

 

grazitti_sapna
17 - Castor

@Miko007 , Not sure if you are doing this but can you please remove rest of the string and only keep the string to be replaced "Wolves" in the text box. Like in this case I would say please keep "Wolves" in the text box and delete the rest.

 

Sapna Gupta
DataNath
17 - Castor

@Miko007 from a little look over this, I can see that you have many formula expressions within a single tool. By any chance, are you trying to alter the "Wolves" part within all of them? If so, when you click on another expression and come back to the first one you changed, this will reset as you're seeing, because you can only update one at a time with an action tool. If this is your goal then I'd recommend having an expression initially creating a field called 'Macro check' or something, whereby the value is just "Wolves" - then make all of the other expressions reference this i.e. IF [home_team] = [Macro check] THEN...

 

With this approach, you'd obviously need to ensure that this [Macro check] was the very first expression and the others sat below it so it can be created before they reference it.

 

Here's an example of me doing it in one of my own macros; creating an initial field which the following expressions all then reference:

 

DataNath_0-1666251788609.png

Miko007
5 - Atom

hi there,
thanks for that tip man! It actually was the reason so all I needed to do was to divide my formula and use separate formula tools for every function. Probably still only a workaround but it's working nice and smooth;)

Labels