"commenting out" temporarily lines or questions in ODK?

What is the problem? Please be detailed.
I want to know if there is a way to temporarily disable a group of questions in ODK (skip them in the form, ie) and then bring them back online later - for debugging, etc.. I tried putting an unrecognizable character in the type column but this just gives an error. This is analagous to turning code into a comment with double ** or other such, in other programming languages. -- I see that ODK forms are not really programs with step by step reading but I would like a way to just save time and temporarily not have certain questions asked while I work other steps out. Maybe the relevance column can be used for this, just set it to false?

What ODK tool and version are you using? And on what device and operating system version?
1.18.1 - on Android, latest OS I think, on a Motorola Nexus 6

What you have you tried to fix the problem?
I tried commenting out by making nonsense in the type column but this creates an error.

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi Steven,

At the moment, ODK does not support such a thing, you cant temporarily disable questions. All programmed questions will appear on the device. But in the app, you can skip/move to the specific questions/group you want, when you open your form, at them top bar, there is an arrow pointing down, with that functionality, you can move to the group you want.

Concerning the suggestion you had, please find the thread for suggesting new features, describe it there so that people understand, it can be implemented.



1 Like

It rather depends on what you mean by 'temporary'... If you put all these questions in a group, you can add a relevant calculation on the entire group to either show or hide everything in that group.

eg you could make the relevant calculation depend on the result of a previous question:

show (select1): "Do you want to see the questions?" [Y,N]
group: relevant="${show}='Y'"

Or if you want to enable/disable the questions while debugging your XLSForm, you could make ${show} a simple calculation and manually edit its value to "Y" or "N" as needed.

show (calculation): calculate='Y'
group: relevant="${show}='Y'"

[or even more simply, manually change relevant="true()" vs relevant="false()"]

The benefit of the former is you can enable/disable the questions on the fly without having to download a new form, but it does mean having to show an additional question in your form to trigger it. Otherwise, if you are debugging your form - and hence downloading revisions constantly - then the latter approach may be more suitable (and you could even just leave the hidden ${show}='Y' in your deployed form).

1 Like

I like @Xiphware's second solution a lot (add a calculate question and use the relevance column to refer to that).

A slightly less elegant variation to this solution that I often use, is referring to a calculate question that is already on your form somewhere before the questions you want to hide, that contains the same answer for all respondents. For example, if I have a calculate question named country, that records the country as string('VN'), then I can put ${country}!='VN' in the relevance column of all the questions I want to hide.

Indeed, the amazing ODK community often picks up suggestions and implements them before you know it. I could imagine having a column in the XLSform called "disabled" where you could put "yes" to hide questions, similar to the "required" column.

1 Like

Another possibility may be to change the question type to "hidden". See discussion here: https://github.com/XLSForm/xlsform.github.io/issues/116. That thread shows that there is an outstanding discussion about perhaps creating a different name (alias) for this in the future, but "hidden" should work now.

1 Like

Wait - I think that is exactly what I am talking about -- and then it can be changed back later to whatever the original type was? that sounds very helpful. I will try it.


1 Like