Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic formula ( to be used in expression) based on column headers

Ravy12
7 - Meteor

Hello experts,

 

I have a dataset (dynamic table) which can have different column names (every time I run the workflow).

 

For eg, one of the runs give below result. Please note there can be empty records.

 

MaterialOracleJDESAPGMD
Aaaaaaaaa
B aa aa
Caaaaaa 

 

second run might give below result and so on. Column headers keeps changing

 

MaterialOracleJDEGMD
Aaaaaaa
B aaaa
Caaaa 

 

I want to build a formula after this dynamic table, which returns 'not found' for empty records and default value for filled records. 

 

For eg, for first run table above, formula tool should give below result

MaterialF_OracleF_JDEF_SAPF_GMD
Aaaaaaaaa
Bnot foundaanot foundaa
Caaaaaanot found

 

How can I build a dynamic formula tool, which creates new column as F_ColumnName (as shown above) and gives "not found" for blank records and default value for filled records.

 

Currently, I hard coded the formula names which gives an error if any of the column are missing and we have a corresponding formula for that column. Attached is the sample workflow.

 

Attached Alteryx workflow, Book1 as input file and picture of my workflow.

 

Regards, Ravi

 

 

 

 

2 REPLIES 2
AngelosPachis
16 - Nebula

Hi @Ravy12 ,

 

You can use a multi-field formula for that

 

AngelosPachis_0-1612808429555.png

 

Hope that helps, let me know if that worked for you.

 

Cheers,

 

Angelos

 

SeanAdams
17 - Castor
17 - Castor

Or you could also transpose this data; get the field names by doing a unique on the "Name" field; and then use a join tool to look for missing values.

This sounds a little more convoluted - but the benefit of doing this is that you immediately have an "Error Data Set" that you can do something with like logging; or setting a default value etc.    And if you want to pop it back into the data stream, you can use a union.

 

@AngelosPachis 's solution is the most direct though - multi-field should do what you need.

Labels
Top Solution Authors