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

Alteryx Designer Desktop Discussions

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

Dynamically add a string to every column

Bigmonki
8 - Asteroid

Hi, 

 

Wondering if anyone can assist? I am writing several workflows where I am bringing in baseline data and 'Market' data. When I join / union these data streams, they all have the column names.

 

What I would like to do is dynamically rename all the columns to identify which are coming from the baseline and which are from the market, so an example:

 

EXPENSE ACCOUNT PRIORITY CONTROL 

 

As these would be the same in both I would like to rename as:

 

MKT EXPENSE, MKT ACCOUNT,  MKT PRIORITY etc for the markets and:

GSIP EXPENSE, GSIP ACCOUNT, GSIP PRIORITY for the baseline

 

Not sure how I can do this? For each query the headings change which is why I would like a solution that just prefixes the column with either MKT or GSIP.

3 REPLIES 3
DavidP
17 - Castor
17 - Castor

How about using a Dynamic Rename tool?

 

dynamic rename.png

RWvanLeeuwen
11 - Bolide

Hi @Bigmonki 

 

you can add a prefix to field names within the join tool

 

prefix after join.jpg

 

 

Best,
 
Roland
 
Infotopics - Benelux partner of the year
Empowering business through analytics. See, Understand, Act!
MarqueeCrew
20 - Arcturus
20 - Arcturus

@Bigmonki ,

 

One of my favorite wonders of Alteryx is that there are so many solutions (hint to mark multiple responses as "Accepted" solutions).  One dynamic method is a variant of the two provided solutions.

 

  1. On input of data, configure the input dropdown to change #5 (Output File Name as Field) to FILE NAME ONLY.
  2. Use the Dynamic Rename to compute the Prefix (e.g.  IIF(Contains(FileName,"Marketing"),"MKT_"+[_CurrentField_]",[_CurrentField_]).  You'll have different formulas on each input or use the same formula with IF THEN ELSE logic.
  3. Enjoy a cup of coffee.

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels