Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Left/Right/Trim function (string, char?)

MID_Pat
6 - Meteoroid

Trying to trim a string with the | character. Example: [string] = this is my comment for today|MID_Pat

Needs to be "this is my comment for today"

 

The username (which won't always be mine) will always be 9 characters (if that helps). I tried TrimRight([string],"|") but that doesn't work based on the bool "|" operator. I tried Replace([string],"|","@@") and then TrimRight([string],"@@"] ... that didn't work either.

 

The only way i can get this done is by adding this SQL code in my Alteryx input: Left([string], CharIndex(Char(124), [string]))

 

(and to make matters worst, Alteryx doesn't understand CharIndex(Char(124) so I can use this inside the workflow)

 

How can I build this into Alteryx, and not SQL? Why? Because some comments do not have the | character, which then return [string] = "null" in Alteryx; so I'd like to build an "If Then Else" statement in Alteryx.

 

Thanks for the help!!

3 REPLIES 3
markcurry
12 - Quasar

Can you use the FindString function to get the position of the |, then use the left?   See attached....

markcurry
12 - Quasar

Or simply using Text to Columns to split on the | either.

MID_Pat
6 - Meteoroid

FindString is exactly what I needed! I never knew this function existed! Thank you!

Labels