community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Dynamic Naming Confusion

ACE Emeritus
ACE Emeritus

I'm trying to create a macro that converts money to USD.  I want all the fields (ones both necessary and unnecessary to the macro to stay the same)  I want it to add a new field that is dynamic to the name of the field being converted ("Amount") with the suffix of '_USD'.  Something like the table below.  I can do the math pretty easily with a join to a currency table and a formula, but the new field is always static.  How would I get it to be a dynamically named whatever was converted by the macro regardless of what that field was called?

 

AlphaBetaGammaDateCurrAmount
AbG2017-12-31USD100
aBG2018-01-01EUR100
Abg2018-01-02GBP100

 

AlphaBetaGammaDateCurrAmountAmount_USD
AbG2017-12-31USD100 100
aBG2018-01-01EUR100 113
Abg2018-01-02GBP100 125
Nebula
Nebula

hi @pcatterson

 

Since the name of the source column(Amount in your example) can change, you must have some way to specify which column to use in your macro otherwise your formula tool wouldn't work.  Use the same input that you use to update your formula to update the rename section of a select tool, with "_USD" appended

 

Dan

Would something like this work for you;

 

2018-12-12_20-41-58.png

 

Use a transpose to flip columns round

You can then use a field info tool to find name of target column

Next do the calculation you need (the end column will be called Value)

Finally dynamically rename the Value column

 

One thing to note you must tick the box that output fields change depending on data or configuration in the interface designer for the macro

Highlighted
ACE Emeritus
ACE Emeritus

You use a newer version of Alteryx than I do (I'm still on 2018.1 because my company's IT team needs to approve all software to be installed), so I cannot open your attachment.  I tried to mirror what you were trying to accomplish but it would not work for me.  Even if I got it working, I believe it oversimplifies what I'm trying to do.  The alpha, beta, and gamma are just hypothetical columns.  I would want the macro to identify the three necessary columns to perform the calculation and just push the others through to the end unchanged.  Your solution appears too narrow

 

AlphaUser DateIotaAmtCurrencyOmega
a2017-12-30i100USDz
A2017-12-31i100GBPZ
a2018-01-01i100EUR

Z

 

to

 

AlphaUser DateIotaAmtCurrencyOmegaAmt_USD
a2017-12-30i100USDz100
A2017-12-31i100GBPZ125
a2018-01-01i100EURZ113

 

would also need to be handled by the same macro

Magnetar
Magnetar

Assuming that for each workflow you are running this process for, you are willing to specify the actual "Amount" field, here's a really quick example.  I'm going to assume that you can add into the macro the process to create the USD value, and that this will occur before the SELECT tool in my macro.

If you choose to use a column name other than _USD as the baseline value, you will need to reconfigure the SELECT tool and the ACTION tool slightly, but I think this example should make that clear.

Labels