Alteryx Designer Discussions

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

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

How can I sort a database in two groups ?

Highlighted
6 - Meteoroid

Hi all

I'm looking for sort a database in two groups :

If the digits on the "Phone Number" column equal "9 digits" put it in one group.

If the digits on the "Phone Number" column less than "9 digits" put it in other group.

 

Main Database

Name 

Phone Number

A

545567831

 

234245643

 

4356

 

432134256

 

246

 

7356483

 

Desired result

 

Group (1)

Name

Phone Number

A

545567831

B

234245643

D

432134256

 

Group (2)

Name

Phone Number

C

4356

E

246

F

7356483

 

Thanks for all.

Highlighted
Alteryx
Alteryx

You can use the Length() function in the formula tool to determine the length of a string in conjunction with an If statement to create the groups. Here is an example:

 

Output Column in formula tool: Group

 

IF Length([String]) = 9

THEN 1

ELSEIF Length([String]) < 9 

THEN 2

ELSE Null()

ENDIF

 

 

Highlighted
Alteryx Partner

Hello. The answer is it workflow. If you need only a group, use a filter tool by 'Groups' Field. Good Luck!!!

Highlighted
6 - Meteoroid
Thanks for your help.

But I couldn't do it in Alteryx, can you please share the way.

Thanks.
Highlighted
6 - Meteoroid
Thanks its helpful

Is there away to make the different two group in a separate sheets.

Thanks
Highlighted
Alteryx Partner

Hello. No, all the data its possible in the same sheet (or in distinct sheets), like this.

order 1.png

And the workflow like this:

order 2.png

If you have the data in differents files, only use Union Tool to unify the datas. If you have the data in differents sheets, apply Unión tool too. If you have the data in the same file/sheet, with my workflow your obtain the answer like the result.

If you need the groups in differents outputs (sheets, files, tables, etc), use filter tool to separate the groups, like this.

order 3.png

Regards!!!

Highlighted
6 - Meteoroid

This is what i am looking for.

 

Thank you so much 🙂

 

 

Highlighted
Alteryx Partner

You welcome and good luck 😉

Labels