Alteryx designer Discussions

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

Macro: Decide Process based on Input

Atom

Hello Community!

First Porst.

 

Im strugling with macros right now.

Im Building a Field validator based on Formulas and RegEx.

 

Every field has its own set of conditions for the fields to be valid and return 1 if valid and 0 if invalid.

This already work by itself but I need to validate 2 times during my workflow so I´m trying to make it a Macro.

 

The main problem is that I want to do it so the macro use one Formula tool for validating "Source1" and another Formula for Validating "Source2"

 

SORCE1 Columns

body1.JPG

 

SOURCE2 Columns

body2.JPG

 

So since the sources are diferrent and the validations are different, right now I have something like this.

Macro.JPG

 

 

I would like to make it so that, when Source1 is disconected it validates Source2 only.

And if Source2 is disconected it validates Source1 throught formula1.

 

I tried using a detour tool and actions, conditions and other tools.

I tried making (Optional) my 2 inputs but formulas will throw an error cause fields inside won't be recognized.

 

What would be the optimal solution fot this? Any ideas?

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

It sounds like you need to build this with only one Macro Input and one Macro Output. Be sure to de-select the field map on the Macro Input tool. Beyond that, I would use a pair of Detour tools controlled by a checkbox on the macro so you can control Formula 1 or 2 when you place it in a workflow.

 

Or have you already tried this with Detour tools?

 

20190815-DetourMacro.png

Highlighted
Atom

Hi!

Thanks for the quick reply.

Okay I´ve done as you suggested, but I have the following question.

How do you manage the fact that the 2 inputs expect different fields

And the 2 Formulas expect a certain Format.

 

In this Build the Input has nodata in the "Text Input"  and Show Field Map has been turned off.

Escenario1.JPG

 

If I "Edit data" to recieve the fields for data set 1, the other Formula would tell me is missing Fields:Escenario2.JPG

 

I've tried making (Optional) the fields with "SORTL (Optional)" but Formulas still throw map error.

 

Thanks in advance!

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

The Macro Input and Detour tools should be field agnostic in this macro. Nothing should be passed to the Formula tool not passed from the detour route. You can double-down on this by putting each Formula in a Tool Container that disables that tool in accordance to the Detour route. 

Highlighted
Atom

 

 Hello,

I did as instructed and setted a checkbox to update actions and enable/disable containers with formula tools inside. Also the detour toos where added.

question1.JPG

 

The issue now is that I'm not sure how to configure that Input agnostic input you describe. The map fields has been disabled here

q3.JPG

 

The Macro throws the following error. Probably because Field1 does not match any too inside.q2.JPG

 

Thanks in advance!

Highlighted
Atom

Hello,

Can anyone explain how to set up a field agnostic input as CharlieS describes?

 

Thanks!

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Sorry for the delay, @jda996 I've been on vacation since my last post.

 

I put together the attached example that shows that the macro should not validate formulas/tools that are in the detour path not taken. Maybe there's an error elsewhere in your macro? Looking at the error, what tool is ToolID 17?

 

 

Labels