Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

How to add the last two digits from one column to the first two digits of a second column

tthomas
7 - Meteor

Hi,

 

 

I am trying to add the last two digits from the date to the first two digits of a number in another column. For example. I have the Year field that contains the date "2015-06-07" . Then I have the Track_Number field that has the number "0345667". I want to add the last two digits of the Year field to the first two digits of the Track_Number field. This would give me "070345667". I used the Formula tool and put in Right([Year],2)+[Track_Number], but I get the error: Error: Formula (25): The field "" is not contained in the record. (Expression #1). The expression does not have an error in the formula tool window, but it has this error in the flow. Can someone let me know what I'm doing wrong?

6 REPLIES 6
markcurry
12 - Quasar

You get the "The field "" is not contained in the record. (Expression #1)" error in the formula tool, where you haven't selected a field to update, or specified a new field.

T_Willins
14 - Magnetar
14 - Magnetar

Hi @tthomas,

 

I think the issue is you are trying to use a string formula against a numeric field.  If you want to keep the 070345667 field as numeric, try the following formula:

 

ToNumber(ToString(Right([Year],2))+ToString([Track_Number]))

 

but this may drop the leading zero.  To convert to a string:

 

ToString(Right([Year],2))+ToString([Track_Number])

tthomas
7 - Meteor

Ok. How do I do that? Do I write an output expression or do I select that somewhere in the tool? I'm trying to see how that looks.

NickSm
Alteryx
Alteryx

@tthomas 

 

My guess is that it's the common mistake of forgetting to determine what column you're creating / updating in the dropdown, your formula looks correct

 

select_column.PNG

tthomas
7 - Meteor

Thanks. I saw that when I went back and looked again. Thanks for your answer and quick reply!

T_Willins
14 - Magnetar
14 - Magnetar

Hi @tthomas,

 

See if the attached workflow works.

Labels