Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Cartesian / cross join without using append join.

stj1120
8 - Asteroid

Hi all,

 

I have two inputs and I need to do cross join without using a append tool. How it is done?

 

I tried using Tile tool by applying Equal Records but no luck. Output is shown in the workflow.

 

Please check and help.

 

Best Regards,

Teja

8 REPLIES 8
PhilipMannering
16 - Nebula
16 - Nebula

Cross join without using the append tool:

PhilipMannering_0-1636113352700.png

 

PhilipMannering
16 - Nebula
16 - Nebula

Here's the code for a copy and paste

import pandas as pd

from ayx import Alteryx
from itertools import product

list1 = Alteryx.read('#1').iloc[:,0]
list2 = Alteryx.read('#2').iloc[:,0]

Alteryx.write(pd.DataFrame(product(list1,list2)), 1)
MarqueeCrew
20 - Arcturus
20 - Arcturus

Create join field on both inputs as:

 

"J"

 

 join in that field. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Christina_H
14 - Magnetar

If you can't use append, you could create a joining field with the same value in each row:

Christina_Hurrell_0-1636113881311.png

 

PhilipMannering
16 - Nebula
16 - Nebula

If you just want to duplicate each month four times then you could use the Generate Rows tool,

PhilipMannering_0-1636113914554.png

 

AZuc
Alteryx Alumni (Retired)

@stj1120 

 

just out of curiosity... why not use Append Fields if it's the tool made for cross join?

André Zuccatti

Sales Engineer - LATAM -
Alteryx, Inc.


stj1120
8 - Asteroid

Hi @AZuc 

 

Yes, I kow the use of Append Tool. Just wanted to try and know if we can achieve cross join results without using Append tool. 

 

Kindly let me know how to achieve it. 

 

Thank you.

 

Teja. 

AZuc
Alteryx Alumni (Retired)

@stj1120 , I would do the same as @Christina_H . Create a "fake" key and use Join Tool.

André Zuccatti

Sales Engineer - LATAM -
Alteryx, Inc.


Labels