Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam posts. As we work toward a permanent solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts. Thank you for your patience!

Alteryx Designer Desktop Discussions

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

Trim Characters From the End of a String

aimzy72
6 - Meteoroid

Hello, 

 

I am trying to trim characters from the end of a string and nothing I'm doing is working. I either get no data in my output or an error. 

 

I'm trying to trim 7 characters from the right hand side of a field. The field name is "Test Name" and just want to trim the dates from the end: 

 

  • Example
    • Test Name
      • This is my test 202308
      • This is my test 202307
      • This is my test 202306

I want to trim the dates so they're all alike so i can join them to other tables. 

 

I've tried this from a previous community discussion but I'm not getting any results: 

 

  • left([Test Name], Length([Test Name]) - 7)

There are a total of 7 characters I'm trying to delete (6 for the date and 1 for the space at the end of the test name.) 

 

Where am I off that I can't get this to work? 

 

Thanks! 

 

 

 

6 REPLIES 6
SPetrie
13 - Pulsar

What kind of error are you getting? 

That formula looks correct. I used it on the examples you gave and every field to end up saying "This is my test"

Can you share the workflow? There may be something else going on to cause the issues.

PhilipMannering
16 - Nebula
16 - Nebula

That should work. Can you share a screenshot of your workflow and the results pane showing the output of your attempted formula?

aimzy72
6 - Meteoroid

Hi, The error says, "The field "" is missing. Compare the tool configuration with the input stream. (Expression #1)"

 

The data in that field is a vstring.

SPetrie
13 - Pulsar

Usually you get that error if you did not specify a field to output your formula tool to.

Add a new column or choose to update the existing Test Field and that error should go away.

snip.PNG

aimzy72
6 - Meteoroid

Hi, Can't share. Office blocks screenshots. Sorry. 

aimzy72
6 - Meteoroid

Brilliant! That did the trick! 

 

In hindsight, total face palm! 

 

Thank you! 

Labels