Defining stopping point for form with weighted questions?

So as far as I can see, there is no way to declare a variable (x) as a number.

The reason I would like this is to make sure that a survey doesn't take up too much of someone's times.

So maybe when they answer the first question x becomes 1.

Then they answer a simple yes/no then x becomes 2 (i.e. x <- x + 1). If they answer an open ended question, x might go up to 5 (x <- x + 3) because that question takes longer to answer and record.

Now I realise that once you do this, people are going to want to do all sorts and treat ODK as a progamming language but I think that something like I have described is necessary.

Has anyone else had the same thoughts? Has anyone found a workaround without having a declared variable?

Many thanks

Do you want to measure elapsed time, or number of questions answered? (which will have a large impact on any potential solution). Also, what do you intend to actually do with this measurement - whichever it may be - once you have it?

Hi Gareth,

I want to have some ad hoc measure of the amount of effort and / or information that has been added to the survey.

My intention is to be that once enough has been added, at a suitable stopping point, the survey will end. But I want to be able to define how much each question is worth myself rather than using time or a one to one parity of questions.



You could probably already accomplish this, by simply deciding which question is 'enough' ,and then making everything subsequent in the form irrelevant if the current time exceeds some duration since the start time. Indeed, you could do this more than once to have multiple time-limited 'stages'...

In terms of actually measuring the amount of time spent on each question, this information is available (after the fact) in the audit log. eg if you want to do some profile analysis of your forms to see where enumerators are spending most of their time.

My main point is probably that ODK isnt a programming language, and never will be; rather, ODK is a toolset. You could arguably script some of the ODK Briefcase tools, but that is more 'programming' workflow around forms, not within forms themselves. The closest you'll find to programming within an XForm is probably the XPath expressions used in relevant, calculate, etc.

1 Like

I think you probably still need to decide and define exactly what metric you want. eg

  • elapsed time spent filling form
  • number of questions answered (either count or as percentage of total)
  • #questions answered / elapsed time (which is arguably normalized 'effort')

Alternatively, if you really want expended effort, you could exploit ODK sensors to measure actual calories burned!

...Framework connects to the current sensor via the Arduino USB Bridge and the heart rate sensor over Bluetooth, and returns sensor data to the Application.


The point is that I would like to be able to define, for myself, how this is done based on a weighting of the questions.

If this can't be done then please say so.

If you don't know, then please let others answer.

Hi, @Stuart_GALVMED!

I'm sorry you're frustrated by this, but please, don't be rude to the people that are trying to help :wink:

It looks like the problem you're trying to solve is quite uncommon and very specific... I don't think you're ever going to get an authoritative answer. If you don't get what you want, I think that you should consider the alternatives @Xiphware has offered.

In any case, I've dug up these two links that look promising:

1 Like

A weighted sum of questions answered is actually little different than a simple count of questions answered, at least in terms of the overall solution.

Please try the following simple form to see if it suits your desired purpose. I've had to make some assumptions as to what you actually want, but this form (4 questions) effectively assigns a different score to each question in its total points (aka 'effort') calculation:

points: calculate = "(${Q1}!='')*5 + (${Q2}!='')*5 + (${Q3}!='')*10 + (${Q4}!='')*15"

Further, each question is relevant if and only if it has (a) been answered, or (b) the current total points is less than some predefined minimum ${min}; eg:

Q1: relevant = "(${points}<${min}) or (${Q1}!='')"

By doing so, you will initially see all the questions in the form. But as soon as you answer a sufficient number to hit the minimum (15 in my form) the remaining unanswered questions will disappear - ie you 'end' the form. In addition, each question is also flagged as required, so that you cannot finish the form until you hit the minimum points threshold.

weightedform.xls (5.5 KB)
weightedform.xml (2.4 KB)

[you didn't indicate if you are using XSLForm or regular XML forms, so I've attached both]

If this is not what you desire, then please (politely) be specific about what you need, perhaps by providing a simple form with a few questions, and explain exactly how you want to assign "worth" to each question and what your "stopping point" might be.

[BTW I've changed to title of this topic to better reflect the desired question]