What ar the allowed functions in expression questions in survey

Is there a list somewhere of what are the allowed functions in Expression only questions. There are 7 listed as allowed with an ‘and others’ when you click on the ? above the Expression input field.

Specifically I’m looking for a way to randomly assign participants to groups where they are not coming from Sona but from a social media posting. So far that requires user input in a previous question to give some sort of varying pseudo random input, eg what are the last 4 digits of your phone number which I then do a {PhoneNum} %3 +1 on. But obviously it would be a lot better to not require a previous input and use something like The Seconds instead.

I’m aware random group assignment is on the way and am looking for an interim solution so if anyone is reading this after Jan 2023 the specific problem should be gone

The list I’m working from is here:

However, random() was added as of yesterday. However, I can’t see round, ceil or floor so this is what I’ve come up with to allocate to three groups

Expression 1 assigns a random value for participant from 1.0000 to 4.0000

random()*3+1

Expression 2 assigns a nominal value for group

iif({participant} > 3, 'both', iif({participant} > 2, 'auditory', 'visual') ) 

Hi everyone,

I was just wondering if the random() function works in Expression questions? I’m trying to do something similar to Andrew and assign groups to participants to show them different parts of the survey, but the random() function doesn’t seem to generate anything for me so I’m not sure if I’m doing something wrong or if it’s not working properly.

Andrew did the solution work for you?

Thanks,
Lorna

Hi Lorna, as it happens I’ve been working on it this week/. It doesn’t work Iin previews (the example will always return 1) however if you Run the survey it will work.

I’ve a quick demo of it working at Pavlovia Survey - note that when you make a selection in the matrix table both the random number in Q1 and the group selection based on it change. The group 1,2,3 part is just using display logic to determine which of 3 questions is shown based on the random value. I just used the first part of the expression above

Hi Andrew,

So it does! I should have checked if running it made it work, but thanks for the quick reply!
And thanks for the demo that’s really helpful.