Alteryx designer Discussions

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

Adding characters to the string

Highlighted
Asteroid

Hi all, i want to add two characters, "20" into a particular column. The column is currently in string.

 

For ex

rowID

11a

11b

11c

 

change to 

2011a

2011b

2011c

Highlighted
Alteryx Partner

hi @fangyi189

 

from the attachment, I use Formula Tools, and use this formula "20"+[RowID]

Highlighted
Meteor

Great info!

I'm trying to trim the last 2 numbers in a string and put them in the column right next to the original column.

any help?

47002564210   to    470025642   10

I thought to add a delimiter then do text to columns but I don't know how to put a period in the snd position from the end either.

Thank you!

 

 

 

Highlighted
Alteryx Certified Partner

Hello @RJS

 

You can convert your data into a string, then create a new field with a formula tool with the expression Right([Field1], 2)

 

Field1 is to replace with the name of the field containing the data you want to parse

Highlighted
Meteor

Thank you for the quick reply!

I will experiment with that.

I also just found another thread that posted this solution...

RIGHT([data], 0)+ToString(LENGTH(Replace([data], " ", "")))

Highlighted
Alteryx Certified Partner

Yup that works too but you can just change the data type to Vstring with a select tool and just use the RIGHT formula, that way you keep it more simple, and you don't depend on the lenght of the number

 

if you set your parameter the 2, it will take the last 2 number, whatever it's lenght

 

Hope that helps

Highlighted
Meteor

It does help, Im using your method. Its much easier! I really appreciate this 

Highlighted
Alteryx Partner
hey RJS, How about you use RegEx tools, it much easy to parse and solve your problem. You can see attachment below.
Highlighted
Meteor

Sadly I'm using an older version and cant open your example.

Thank you for considering. 

Alteryx Certified Partner
Alteryx Certified Partner

older version?  You can edit the yxmd file with notepad

 

<?xml version="1.0"?>
<AlteryxDocument yxmdVer="11.3">

The 2nd line contains the version number.  Set it down to 10.0 (or .0 of your version) and save it.  If no "NEW" tools are in the workflow, you should be able to open and run the workflow without an issue.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Labels