Random pick - add conditions to equally pick

Hello everyone,

So I have a scenario that allow me to randomly pick a number from set variables which are linked to CRM users. The objective is to attribute deals equally between all of them.

The way it is set up now, choses randomly a number between 1 and 4. So sometimes it will pick 3 times the number 4 et 1 time the number 2 for example.
The way I would like, is to pick 1 time number 1, 1 time number 2 etc etc.

Is there any way to make this possible ?

Here is my scenario :


Here is how the random pick is set up :
image

Thanks for your help !
Laura

Hi @Laura ,

Could you upload an example of the output bundle of your first module?

If it is a set of bundles, you could use:
image

It will give you a integer between 1 and 4, as it is modular, it is also periodic.
In your router, depending on the route, you just have to test if this variable is equal to the route number.

BR,

PBI

3 Likes

Hi @Philippe_Billet,

Thanks for your response.
here is the output of the Pipedrive module


And here is the set variables module :

image

Please, find in attachment an example blueprint that could help you:
Random pick - add conditions to equally pick.json (16.4 KB)

It distributes equally the different input elements into 4 routes.

You could use this principle just after the 1st Pipedrive CRM module (do not use the iterator, in my example, it is just here to transform an array into a set bundles).

2 Likes

thanks again @Philippe_Billet, but I can’t come to understand how to make this work.

Could you explain the goal of the modules “IDs sales” and “Choisi un ID”?
More basically, could you add the blueprint of your scenario?

2 Likes

ID sales = variable between 1 and 4 related to Pipedrive IDs of the sales that I want to attribute a deal to
Choisi un ID = is the module that will randomly choose a number between 1 and 4 t then conduct to one of the routes.

Here is the blueprint :
blueprint.json (221.8 KB)

So I understand a little bit better, in fact the first module returns a set of operations that is not indexable (not like an array)…

But there is " operationsConsumed" that could help us.
Could you try this:
blueprint(13).json (220.1 KB)

3 Likes

yes but if I use the set variable in your blueprint then I can have an array with the ID’s.
And I’m thinking maybe I need to use and combination of shuffle(sort) functions to pick up from the arrays but in a specific order. This way it wont be able to pick the same number to times in a raw + would be able to pick from all for numbers if I have 4 deals to attribute?..

Currently it doesn’t give the expected result?

1 Like

Unfortunately it is not working, it attributes the same deal several time to different sales

Hi Laura,

so the first module is producing only 1 deal? Then its automatically assigned to a random route? And you need over the course of multiple scenario runs to spread it out evenly between them?

I suggest using a data store to store which route got the last deal and then exclude them in the following runs. Once all 4 have gotten a deal each - reset the data store. Or something there of for X amount of deals each, you can add an incrementor and when it reaches a certain amount - that route cant be taken any more until all are equal and its reset.

3 Likes

Hi @Stoyan_Vatov, thank you for your answer.
Actually the module can produce from 0 to a 100 deal each run, it will depend on how deals are in the pipeline at this moment.
The datastore could work, but it’s really not optimal since I don’t know how many deals I will have.