# Alteryx Designer

SOLVED

## Multi-Field Tool with dynamic fieldnames in formula expression

Highlighted
5 - Atom

Hi All,

I am wondering whether there is an elegant solution to the following problem.

Example data:

v1, v1faktor,

v2, v2faktor,

v3, v3faktor, ...

Following data should be the output:

v1new = v1 * v1faktor,

v2new = v2 * v2faktor,

v3new = v3 * v3faktor, ...

I tried the multi-field tool with v1, v2, v3 as input, but struggled to modifiy the field name in the expression to work dynamically.

Is it possible to make an expression similar to [_CurrentField_] * '['+'[_CurrentFieldName_]'+'faktor]'

Thanks for any help in advance!

Sabine

Highlighted
12 - Quasar

I think a standard formula tool would work best in this situation since you want to create a single new field that is the product of two other fields.

The multi-field formula tool is useful if you want to apply an operation across many fields at once and only specify the formula once.  For example, let's say i have 20 fields of numeric cost data in a foreign currency and I want to multiple all of them by the same factor to convert all 20 to my domestic currency- that's where the multi-field formula tool would be handy.

Highlighted
5 - Atom

In fact I do have sets of e.g. 10 (sometimes more) variables v1, v2, ..., v10 which I have to process in several steps, each time resulting in 10 new variables v1_new, v2_new, ..., v10_new. Usually the Multi-Field tool works pretty good for this. But in some cases I need to include in the calculation of the new variables other corresponding variables like v1_faktor, v2_faktor, ... v10_faktor.

Currently I use the normal formula tool typing the same formula (v1_new = v1 * v1_faktor) 10 times. But I'm sure there must be a better and more fail-safe way to do this.

Highlighted
11 - Bolide

Hi @SP, I'd suggest taking a look at the dynamic formula macro from CReW:

http://www.chaosreignswithin.com/2013/11/dynamic-formula-macro.html

Highlighted
5 - Atom

Highlighted
5 - Atom

Thanks @DataBlender and @AdamR, this should work fine for me!

I will definitely go and have a look and those other useful CReW stuff... :)

Labels