Display a random number on survey123 form

334
2
04-05-2023 10:42 AM
JenLangevin
New Contributor III

Hello, 

I would like to have a random number between 1-360 displayed on my survey for the users to see while they are entering data. Is there a way to accomplish this? 

Tags (1)
0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @JenLangevin

You can use the random() function to generate a random number between 0 and 1 then multiply that by 360 to get a random number between 1 and 360. You can also make it a whole number by wrapping it in an int() function. 

The whole calculation would look like int(random() * 360). 

Thank you,
Zach
NinaWinter-Hjelm_Asker
New Contributor

Hi @ZacharySutherby 

Looking for a way to accomplish this in the Survey123 web form. 

Or some other way to link a point survey to a polygon survey. My plan was to set up a survey collecting a point, and asking the user if they also want to submit an area. If yes, linking to a new survey collecting a polygon using URL parameters and a generated random ticket to ensure that I can join or relate the points and polygons afterwards. But I can't seem to find a way to generate a random ticket in the Survey123 web form? 
My surveys need to be public, and I am using other calculations to extract values from other layers. So from my understanding, if I wanted similar functionality in the ConnectXLS I would need to use Javascript functions which are not supported for public surveys. Thus I need to work in the web form. 

Would be grateful for any advice or input, thanks 🙂 

0 Kudos