Alteryx Designer Desktop Discussions

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

calculating string lengths on various String rows....

Jazzy
7 - Meteor

I have a dataset of 5 string columns. I want to find out the length of each row n save the length in new column...

 

Awaiting for response..!

 

 

9 REPLIES 9
Kenda
16 - Nebula
16 - Nebula

Hi @Jazzy 

 

Alteryx has an expression Length() that provides the length of a string. If you use this 5 times and add them together, you should get what you're looking for. For example,

 

Length([Field1]) + 
Length([Field2]) + 
Length([Field3]) + 
Length([Field4]) + 
Length([Field5])

 

Hope that helps!

marcusblackhill
12 - Quasar
12 - Quasar

Hey @Jazzy !

 

You want to save the lengths in only one column or in one column for each one?

 

all in one column can do like @Kenda said, if you want one length column to each one, can use length([Current_field]) in multi-field formula marking only that columns you want to do the lenght, the final result will be 5 new columns, each one with the respective length of the originals.

 

hope that helps!

Jazzy
7 - Meteor

Yup ..Thanks....Ur response is highly appreciated....Since I m new in alteryx ....I m bit confused...

I'll post the question ..If possible just guide me...

 

Make an input dataset with 5-7 string fields. Output the longest record in each of those fields
along with their respective lengths. Save the output in a CSV file. Output must be in the below
format:


Field Name               Longest Record         Length

Jazzy
7 - Meteor

Yup ..Thanks....Ur response is highly appreciated....Since I m new in alteryx ....I m bit confused...

I'll post the question ..If possible just guide me...

 

Make an input dataset with 5-7 string fields. Output the longest record in each of those fields
along with their respective lengths. Save the output in a CSV file. Output must be in the below
format:


Field Name               Longest Record         Length

pedrodrfaria
13 - Pulsar

Hi @Jazzy 

 

For education purposes and in context to what the two answers above explained, you can do it fairly quickly. I attached two different ways you can accomplish this, a manual (formula adding all 5 fields) or a more dynamic way of doing it. The dynamic way comes in handy if you ever needing to do something like this and does not want to type Column1+Column2+Column3 ....

 

pedrodrfaria_0-1609254555060.png

 

 

Pedro.

Kenda
16 - Nebula
16 - Nebula

Hi @Jazzy 

 

I have attached a sample workflow that I think should get you what you're looking for. The key was to first transpose the data so that you could use the summarize tool to get the longest record for each row.

 

Hope this helps!

 

Kenda_0-1609254980537.png

 

Jazzy
7 - Meteor

TYSM ..I'll try this.

pedrodrfaria
13 - Pulsar

Hi @Jazzy 

 

We recommend that if you have a new question that you open a new discussion post. 

 

But here is a workflow that accomplishes this task:

 

pedrodrfaria_0-1609255243569.png

 

Jazzy
7 - Meteor

Tysm..I'll try.

Labels