Random number generator > than previous. Survey123

08-31-2020 09:44 AM
New Contributor III


So I am creating a survey in Survey123 where I am hoping to create a calculation that generates a random number greater than the previous, in a repeat. 

We use random numbers to generate where a biological sample will be taken within a given distance. Ideally starting at 0ft and performing 8 random biological assessments before the end of the given distance. I already created two calculations, one which creates a number between 1 and 99, to obtain a percentage of the total distance: round(random()*99,1). And a second which multiples that number by the total distance: round(${riffle_length} * (${random_riffle} div 100), 2). 

All I want to do now, is set the random number generator to ensure the next random number is always greater than the previous.

How would I approach doing this? Or would a repeat not even be the best method in the first place. 

0 Kudos
1 Reply
Esri Notable Contributor

Hi Triston,

I believe the best way to achieve this would be by using a custom JavaScript function and the pulldata() function. You can find out more information here about pulldata() @ JavaScript support in Survey123: JavaScript functions in survey forms—ArcGIS Survey123 | Documentation  and https://community.esri.com/groups/survey123/blog/2020/08/07/extending-survey123-smart-forms-with-cus....

Of course you will need to write your own JS function (or find one that does what you are after), however this will be the best way to achieve the workflow you are after inside a Survey123 survey form.



0 Kudos