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

Passing a variable to a formula tool in Macro

Nidhin
8 - Asteroid

Hi

 

I am trying to pass a values to a formula tool (inside a macro) to use for calculations.

I have a workflow from with i want to pass the creation date to a macro.The macro is designed as a batch macro.And using this creation date i will name my files.

I tried adding an action to the formula tool,but it does not seem to be working.Attaching the screenshots

 

Thanks

Nidhin

 

 

5 REPLIES 5
JordanB
Alteryx
Alteryx

Hi @Nidhin

 

If you are passing the same date into the input tool and the formula tool you will be able to use one control parameter and two action tools.

 

Inside the action tool can you make sure you are selecting replace a specific string and remove just the quotes around the value you have in the formula tool. 

 

It seems you have null in the formula tool, but to ensure you are replacing the correct value, I would suggest adding a dummy date in the field in quotes. You can select the value and use 'replace a specific string'. Please just remove the quotes, do not delete the whole string a type the date. 

 

This applies the same for the file path. Please delete everything but the date you are replacing.

 

 

2019-01-03 08_01_17-Window.png

 

Best,

 

Jordan

Nidhin
8 - Asteroid

Hi Jordan,

 

Thanks for the reply.

 

But i need to pass the date as per the creation date of the files.I cannot hard code  the date by Replacing with specific string function.

My purpose is to identify the creation date (from Directory tool) and use that info to generate sheet names inside the macro.

Is there a way to do this ?

 

Nidhin

JordanB
Alteryx
Alteryx

So the replace a specific string isn't hard coded, it will be replaced with whatever you pass into the macro from your directory tool. 

 

Where are you wanting to replace the sheet name? in the input tool?

 

Best,

 

Jordan

Nidhin
8 - Asteroid

i will be generating the sheetnames and using them outside the macro.

The macro output is expected as <orginalSheetName>_<Date>

Date will be passed by the directory tool (Creation Time field)

Nidhin
8 - Asteroid

Hi @JordanB

 

I was able to get it done.I needed to make a small change.Since i needed to pass 3 variables,i had to use 3 action and control parameters.

1 for passing the file name,and the one to pass 2 different creation time from the master workflow.

 

Thanks a lot for the explanations.

My initial understanding was that, if i check "Replace specific string" it replaces the value with what i provide there.

I get it now that ,the string we keep in the "Replace specific string" field will get replaced with whats being passed

 

Nidhin

Labels