Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Macro for filter values and save it as different results

Manojkumar
8 - Asteroid

Hi,

 

I have the following data

 

AB 
11 
22 
33 
41 
52 
63 
74 

 

I want to write a macro which takes the value from B and filter A, then multiply them and store it in subsequent columns.

The output I want is

 

amultiplier    
111 2
224 8
33 3 69 12
444 8 12 16
55 510 15 20
66 6 1218 24
77 7 14 2128

 when I tried in batch macro using control parameter , update value as shown below I get the following result.

ab 
111
224
339
4416
5525
6636
7749

 

Can some one please help me on what is wrong with the flow.

 

delte.png

7 REPLIES 7
StephenR
Alteryx
Alteryx

Looks like you want an iterative macro. I have a couple of questions: In the output example it looks like Column A was just added to the result each time. In the batch macro example it looks A and B are multiplied, but the pattern on B is not the same as the top input data, is what you want Column A multiplied by Column B? Finally, how many times do you want this multiplication to happen?

Regards,
Stephen Ruhl
Principal Customer Support Engineer

Manojkumar
8 - Asteroid

Hi Sruhi,

 

Thanks for replying. Yes, I want the column A to be multiplied with column B values.

About how many times, its the number of values in column B. Lets say, first take column B value 1, multiply all the values of A with 1.

Then take the second value of column B which is  2, multiply all the values of A with 2. Like this do for all values in column B.

 

Hope I have clarified. kindly let me know if you need more info.

AdamR_AYX
Alteryx Alumni (Retired)

Does the attached do what you are looking for?

Adam Riley
https://www.linkedin.com/in/adriley/
StephenR
Alteryx
Alteryx

If you are filtering then multiplying isn't that the same as just saying Col A*Col B? I feel like I'm still missing something.

Regards,
Stephen Ruhl
Principal Customer Support Engineer

Manojkumar
8 - Asteroid

Hi AdamR,

 

Thanks for the workflow. It worked like a charm.

 

Just an added request, is there a way to save each batch run as different sheets in same Excel file.

 

Thanks in advance

AdamR_AYX
Alteryx Alumni (Retired)

You certainly can. See the attached. You might want to clean up what fields go into the excel file, but it should give you the idea.

Adam Riley
https://www.linkedin.com/in/adriley/
Manojkumar
8 - Asteroid

Hi Adam,

 

Thanks for the workflow, When I tried with my workflow, I am getting the following error.

 

Error: Churn trend macro (15): Record #2: Tool #27: Target Excel file may be corrupt! Cannot find required file, or element within file: xl/workbook.xml

 

I have attached the photos of macro controls, I have tried and searched for solutions, I couldn't find any. Even if I copy the macro tool from yours to mine,i am getting the same error. It works as long as it is in your workflow. Kindly help me understand what I am doing wrong,

 Adam.jpg

Labels