Randomly picking from a list

Hi everyone,

I have a list of IDs and in my scenario I would like to add a step where I can randomly pick an ID from this list and it would be a different one every time.

Here is how my scenario looks like right now :

Here is how my list of IDs looks like :

Thanks for your help,
Laura

1 Like

HI Laura. There are many ways to do this. What is it that you are trying to achieve? Do you need to avoid duplicates? Once one id has been selected can it be selected again? etc etc.

1 Like

@IainM thanks for your reply.
I am creating an activity in pipedrive and the team is composed of several people, which all have their ID. And y goal is to randomly attribute each of the activities created to one member of the team.
So one ID can be selected several times.

The end result will likely be more complex than this as you add your specific requirements but the easiest way to do it is to use the “set variable” module to generate a random number using the formula

{{round(random * 10)}}

That will generate a random number between 0 and 10. You can then set up the filters to route according to the value generated. See below.

image

Hopefully that makes sense

1 Like

@IainM thanks
Looks like it’s working and choosing randomly a number but I had like an infinity of run. Whereas I would like it to run only once for one operation before. Do you know how I could fix this ?

looks like you are using a huge number of operations on that. can you repost the screenshot but zoom in a little so i can see it more clearly?

1 Like

Uploading: image.png…

image

Here you’ll see more clearly, it used 187 operations in like less than 20 secs

it is the text parser causing the jump in Ops. check to ensure it is working as expected.

You can move the Random variable module before the text parser module - it can go anywhere before that. But the issue with the ops is the text parser

1 Like

Actually, it initially was after the set variable module which is why I also have 187 operations on it so I moved it before.
Sorry should have cleared that out before i sent the screenshot.
Here you can see how it was configured when I lauched it :

@IainM it seems like the issue is from the set variable module, which keeps creating operations with random number instead of being executed only one time …

i just noticed though you had a “set multiple variable” module earlier in the scenario. How about adding the random number generator in there and removing the other set variable module. that way it doesn’t cost you any more operations but also getting rid of the module might hopefully stop the anomaly.

1 Like

Well the set up multiples variable is the module where I say that variable 1 = the Pipedrive ID of user 1, variable 2 = the pipedrive ID of user 2 etc. so I have to keep it. But maybe I can move it after the round function module and see if it resolves the issue.

@Laura Your operations start adding up after your pipedrive module.
Most likely the Search you are doing outputs a large amount of records (so the search is not working correctly). Can you show settings & the output (the round circle above the module) of the Pipedrive module?
Make sure those are working correctly :wink:

1 Like

@Bjorn.drivn Yes you’re right. I have a large number of operation in the search module with pipedrive.

Here is the setting :


Here is the output

i wasn’t suggesting remove the multivariable simply add the random variable to it and call on it later (the variables don’t have to be related in that module).

@Bjorn.drivn is totally right (as always). The output from your pipedrive search is generating the additional operations 1 op to do the search but it it passes on i(in this case) 187 to the next module

1 Like

@Bjorn.drivn
But I have a value with a specific ID to search for in Pipedrive. I really don’t understand where all the outputs are coming from.
Any idea how to fix this ?

I do not know what you are doing with your Text Parser @Laura (the input of the Pipedrive module). But I would recommend you make sure the search is working first, by manually testing with just hardcoded values, before you continue working on the rest.
The limit of your Pipedrive module is 200; which shouldn’t be an issue if you search for a specific Organization, but if your search term is incorrect it will return 200 records :wink:

Haha just something you see quickly out of some good experience :wink:

I think @IainM will be able to help you from here. Just make sure the search you are doing is working properly @Laura

1 Like

Right looks like the error was coming from the match pattern that wasn’t working correctly causing issues in the pipedrive module and so on.
Thank you very much @IainM and @Bjorn.drivn for your help !

1 Like

magic - well done. Delighted you managed to solve it. Shout if you need any further help.

2 Likes