Distribute randomly

Hello!
I have two tables like the ones below. Could you please help me with an idea? In Table 2, I need to randomly redistribute one agent according to the team. Do you have any idea how I can do this? I tried with the Join node, but it didn’t work correctly :slight_smile:

Table 1
Agent Name Team
James Sales
Emily HR
William IT
Olivia Operations
Alexander Sales
Sophia HR
Benjamin IT
Charlotte Operations
Henry Sales
Grace Operations
Table 2
item List Team Agent Name
Item 1 Sales James
Item 2 IT Wiliam
Item 3 Operatios Olivia
Item 4 HR Sophia
Item 5 Sales Alexander
Item 6 IT Benjamin
Item 7 Operatios Charlotte
Item 8 HR Emily
Item 9 Sales Henry
Item 10 IT Wiliam
Item 11 Operatios Grace
Item 12 HR Sophia
Item 13 Sales James
Item 14 IT Benjamin
Item 15 Operatios Olivia
Item 16 HR Emily
Item 17 Sales Alexander
Item 18 IT Wiliam
Item 19 Operatios Grace
Item 20 HR Sophia

Hi @madac,

I don’t know if I understood your request correctly: here is a small workflow with my attempt.

What I did was: randomly shuffling all rows and then sorting them by team (ie randomly shuffling agents according to team). If it’s not what you need, let me know and I’ll try to help :slight_smile:

Have a nice evening,
Raffaello Barri
Let’s connect on LinkedIn!

2 Likes

@lelloba I have 2 excel file.
First excel file is populated with the information from tabel 1.

Table 1
Agent Name Team
James Sales
Emily HR
William IT
Olivia Operations
Alexander Sales
Sophia HR
Benjamin IT
Charlotte Operations
Henry Sales
Grace Operations

The second excel file is populate with the information from table 2, column Item list and Team.

Table 2
item List Team Agent Name
Item 1 Sales
Item 2 IT
Item 3 Operatios
Item 4 HR
Item 5 Sales
Item 6 IT
Item 7 Operatios
Item 8 HR
Item 9 Sales
Item 10 IT
Item 11 Operatios
Item 12 HR
Item 13 Sales
Item 14 IT
Item 15 Operatios
Item 16 HR
Item 17 Sales
Item 18 IT
Item 19 Operatios
Item 20 HR

I nedd to distribute randomly, the items from excel 2(table 2) between agents from tabel 1, by the teams.
So, the names of the agents from table 1, team it, should be distributed equally among the rows in table 2, team it.

Finaly, the table 2 will be completed like this:

item List Team Agent Name
Item 4 HR Sophia
Item 8 HR Emily
Item 12 HR Sophia
Item 16 HR Emily
Item 20 HR Sophia
Item 2 IT Wiliam
Item 6 IT Benjamin
Item 10 IT Wiliam
Item 14 IT Benjamin
Item 18 IT Wiliam
Item 3 Operatios Olivia
Item 7 Operatios Charlotte
Item 11 Operatios Grace
Item 15 Operatios Olivia
Item 19 Operatios Grace
Item 1 Sales James
Item 5 Sales Alexander
Item 9 Sales Henry
Item 13 Sales James
Item 17 Sales Alexander

Think I got it - there’s a node “Random Matcher” that does the job when using it inside a group loop that iterates over the data for each team in table two:

Prototype:
distributerandomly.knwf (90.2 KB)

Overview:

Comments:

  • I think in your table one was a small typo for “Operations” that resulted in an initial mismatch - I fixed that up in my example (i.e. changed “Operatios” to “Operations”)
5 Likes

@MartinDDDD thanks! it works!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.