Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Dynamically referecing columns in formulas

AmineB
6 - Meteoroid

Hello,

My first post here so I apologize in advance if broke Labels/Posting Rules.

 

I have a column (named Field) that contains other column names. I want to dynamically reference said columns in a formula.

 

I tried using double brackets: [[Field]] but that won't work.

 

Is there a special syntax to bypass this ?

6 REPLIES 6
ydmuley
12 - Quasar
12 - Quasar

Do you have a sample example? @AmineB 

Regards,
Yugandhar Muley (Yug)

Alteryx ACE | Alteryx For Good India Lead | Bengaluru Alteryx User Group Lead
AmineB
6 - Meteoroid

Hello,

I'm not allowed to upload anything so I'll try my best to retranscribe the table.

Col ACol BCol CFieldValue
110100Col AYes
220200Col BYes
330300Col CYes
110100Col ANo
220200Col BNo
330300Col CNo

 

Basically, I want to do a formula :

IF [Value] = "Yes" THEN

         IF [[Field]] = 10 THEN "Message 1" ELSE "Message 2" ENDIF

ELSE

         IF [[Field]] = 10 THEN "Message 3" ELSE "Message 4" ENDIF

ENDIF

 

 

ydmuley
12 - Quasar
12 - Quasar

It is still difficult to comprehend your expected output or the formula that you have written.

 

I have written down something like this, is this what you are looking for?

 

If not, instead of writing the fomula, please just tell me the expected output (dont write formula) just tell what you are looking to find within the data set.

 

ydmuley_0-1585657316098.png

 

 

ydmuley_1-1585657335341.png

 

Regards,
Yugandhar Muley (Yug)

Alteryx ACE | Alteryx For Good India Lead | Bengaluru Alteryx User Group Lead
AmineB
6 - Meteoroid

Thank you for your patience. 

 

The condition is based on the Field column which contains in my dataset +130 different variables (each variable is named after an already existing column)

 

In the example I made I can make a switch statement for 3 different values. But for +130 it's more complicated.  I'll try to make a different example:

 

COL 1COL 2COL 3COL 4COL 5COL 6Field
1 3466 98COL 1
1 3466 98COL 2
1 3466 98COL 3
1 3466 98COL 4
1 3466 98COL 5
1 3466 98COL 6

 

My goal is to check whether each one is empty or not, I apply a formula  :

 

IF IsEmpty([[Field]]) THEN "Yes" ELSE "No" ENDIF

 

I was hoping that [Field] would be read as COL 1 and the I have the second brackets so it be treated as [COL N]

To get something like this: 

 

COL 1COL 2COL 3COL 4COL 5COL 6FieldResult
1 3466 98COL 1No
1 3466 98COL 2Yes
1 3466 98COL 3No
1 3466 98COL 4No
1 3466 98COL 5Yes
1 3466 98COL 6No

 

  

The ultimate goal is to have for each row tracking each column whether it's empty or not. 

 

 

patrick_digan
17 - Castor
17 - Castor

@AmineB Out of the Box the Dynamic Replace is the tool to use for something like this. I've attached an example. I believe there is a Crew Macro if you use those. I also have an idea out there of adding an eval function which would make this much more straightforward.

AmineB
6 - Meteoroid

@ Hello, thank you for the reply.  

 

I agree with you, I believe I'm looking for something similar to the eval function. Unlucky it's not yet implemented. 

For security reasons, I can't use macros. 

 

I'm checking out the Dynamic Replace and it seems the right track for me. So thank you.

Have a good one 🙂 

Labels