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

Create column with rows of calculated text

ewall_dup_446
5 - Atom

I'm trying to create a new column that formulates a text string, using other columns of data. The formula I have right now is:

IF [Column 2] != "N" THEN "Went from" + [Datapoint1] + "to " + [Datapoint2] ELSE " " ENDIF

 

I am getting a parse error 'Type mismatch in operator +. I've tried putting the column names in " ", but then it just surfaces the text of the column names (looks like "Went from [Datapoint1] to [Datapoint2]". 

 

I want the column to be dynamic, where if the row of data meets the IF criteria, it says "Went from 1 to 4", or "Went from 1 to 500" depending on the values in the corresponding datapoint1/datapoint2 columns. What am I missing? It's been awhile since I've used Alteryx so a little rusty 🙂

3 REPLIES 3
apathetichell
19 - Altair

Hi!

 

You're very close but the issue is that either or both [datapoint1] or [datapoint2] is a number - not a string (I'm assuming [column2] is a string).

 

If you put both in the tostring() function via tostring([datapoint1]) and  tostring([datapoint2]) but leave the rest of your formula the same - it should work.

DylanDowrick
9 - Comet

replace [Datapoint1] with: ToString([Datapoint1]), that should cover it!

estherb47
15 - Aurora
15 - Aurora

Hi @ewall_dup_446 

 

The tostring() function around both of the datapoint fields should, as has been mentioned, solve the problem

 

Don't forget to add spaces in your strings. tostring([1])+"to"+tostring([2])  will come out as 1to2 for example. " to " results in 1 to 2.

 

Cheers!

Esther

Labels
Top Solution Authors