# How to automate in a survey a number of answers for option 1 and another number of answers for option 2? (it also contains multiple answers to be checked)

Hello,

I have this survey (“Test1”) as an example URL-> Survey Test1 - iSondaje.ro
After I press “Start”:

I will have the question “Question1” with 4 possible answers and you can pick only one answer (let’s pick Option2 as an answer"):

After that, we press the button “Continue” and we arrive at the second question “Question2” and here we can pick multiple answers from 3 possible answers. Let’s pick “OptionA” and “OptionC:

After we press “Continue” the survey is complete.

If you can help me, my request is to automate this survey 900 times and I don’t know how to automate the following results:

Question1:

and

Question2:
Option A = 85% (765 answers, because we select multiple answers A and C);
Option B = 15% (135 answers);
Option C = 85% (765 answers, because we select multiple answers A and C);

->The percentage is how many times the Option is selected out of 900 times.

Thank you!

Robert Costache

1 Like

Could You Explain what do you mean by these Percentages?

Is it the Percentage of times the Option is Selected out of 900 times ?

2 Likes

Yes. The percentage is how many times the Option is selected out of 900 times.

1 Like

Check the Below Workflow :

I did not test it for 900 times. But you could try it with the Actual Numbers.

The Logic used is as below considering the First Question :

1. Take the Lowest (36) Number of times the Button needs to be Selected, Limit the Iteration to Click on it using an if Activity.
2. If the Iteration Count passes the Lowest Number, take the Next smallest number (261) and Limit the Iteration to Click on this, Since the Iteration has Passed 36 times, it will not click on the First Button.
3. Similarly, if the Iteration Count has passed 261 times, we would need to Limit the Selection for the Third Option.

The Same logic has been applied for Question 2 as well.

However, we may face loading issues with respect to the web page. (Takes Time for the Next Iteration/Next Survey page to Load). Hence have introduced a Delay of 1 min 30 sec.

This delay can be adjusted to make it more faster. But a Delay would be necessary.

Let us know after you have checked the workflow and provide feedback on it.

1 Like

It works. If you can help me, I need an extra thing: How to select a random answer from 3 options out of 4 possible options in this survey (example for Question1) to be repeated 900 times?

Thank you!

If we already know what are the Options available, we could create and initialise an Array or a List in the Below way :

``````optionList = new List(Of String) from {"Option1","Option2","Option4"}
``````

where `optionList` is a variable of Type `List(Of String)`

Next we can create a Random Variable, say `rndVar` using the Type `System.Random`

Initialise the random variable, `rndVar` like below :

``````rndVar = new Random
``````

Then we need to create a Variable to Store the Random Item Selected, say `selectedOption` of Type `String`.

We do the following assign to get a random value from the List :

``````selectedOption = optionList(rndVar.Next(optionList.Count))
``````

We can then use this `selectedOption` variable in the Selector of the `Click` Activity.

If we do not know the Options before hand, we can first get it by using `Find Children` Activity and create the option list.

1 Like