You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add 'exclude' column to exclude questions from output #116
The hidden question type is not documented on the main page or the ref table. It refers to this line in pyxform.
The feature includes a question in the form but doesn't display it. Unfortunately it replaces the actual question type (e.g. select_one animals) so it's a bit unclear why it was implemented this way or what the ideal use case is.
It's an important use case to be able to include questions in your XLS form that you don't want to include in the current survey (or even in the XML).
A better route for a new enhancement would be to add a flag to questions that leads them to being ignored by pyxform during the conversion. E.g. a column exclude, and marking each line to be excluded as TRUE.
It was added recently here: http://xlsform.org/#question-types
There is a use case discussed here: #96.
I agree it should also be added to the ref-table.
The use case you describe would require a new feature, like the column you describe. I support that.
Wrt to the existing 'hidden' type (not the exclude functionality described above), I believe the only difference with a calculation is that the hidden type doesn't require a calculation.
When I look at the medic mobile comment linked to PR #96, they like using the hidden type to store constants in the XForm (using the default column) but without having to use (and explain to users): calculate=".".
Update: Just realized the hidden type covers the proposed XLSForm/pyxform#97 as well. We could make hidden an alias for constant as well. That's a nicer name imho.
And it looks like hidden is really a new question to prevent the missing calculation warning. Sounds like the things we used to do in the dark days. Would it be reasonable to get pyxforms to make this more of a macro (so if you use it, it's a calculate with . as a calculation?
I think adding the macro would add complexity and am not sure what it would accomplish. There currently is no XForms syntax associated with type=hidden. It seems to just leave out the calculate requirement, so it's useful to store constants and provides a cleaner XForm output.
Sidenote: I just noticed that calculate="." does not actually pass ODK Validate, so currently we'd have to do something like calculate="once(2)" if we'd like to use a default with a type=calculation (or use Enketo Validate or fix the dependency cycle error in ODK Validate). See hidden5.xml.txt -> https://validate.enketo.org
It seems to just leave out the calculate requirement, so it's useful to store constants and provides a cleaner XForm output.
Precisely. The purpose of hidden - in my view - is precisely as a means to insert a constant (default) into the XForms instance XML, as @MartijnR noted. Having to do this using a redundant calculate is inefficient - it'll become yet another calculation to worry about re-evaluating whenever things change...
I actually like hidden exactly the way it is! :-) Although the term 'constant' might indeed be a bit more descriptive.
[well, not exactly the way it is... it would be even better to have a means to insert a constant element into the instance XML without the need for a binding, which you can have in raw XForms. But maybe that's asking for way too much].
In case it's helpful for reference: there's an undocumented—except for some SurveyCTO documentation and sample forms—disabled column that causes pyxform to completely discard rows of the input XLSForm spreadsheet. I found this while troubleshooting a problem with a KoBo library that didn't support disabled.
Activity
tinok commentedon Apr 24, 2018
It's an important use case to be able to include questions in your XLS form that you don't want to include in the current survey (or even in the XML).
A better route for a new enhancement would be to add a flag to questions that leads them to being ignored by pyxform during the conversion. E.g. a column
exclude, and marking each line to be excluded asTRUE.MartijnR commentedon Apr 24, 2018
It was added recently here: http://xlsform.org/#question-types
There is a use case discussed here: #96.
I agree it should also be added to the ref-table.
The use case you describe would require a new feature, like the column you describe. I support that.
yanokwa commentedon May 9, 2018
I like the exclude column idea. @tinok, it might be easier to file a new issue where we can discuss it.
Before we document
hidden, I'm not sure I find the use-case compelling. Why not use calculates?MartijnR commentedon May 9, 2018
Wrt to the existing 'hidden' type (not the exclude functionality described above), I believe the only difference with a calculation is that the hidden type doesn't require a calculation.
When I look at the medic mobile comment linked to PR #96, they like using the
hiddentype to store constants in the XForm (using thedefaultcolumn) but without having to use (and explain to users):calculate=".".Update: Just realized the
hiddentype covers the proposed XLSForm/pyxform#97 as well. We could makehiddenan alias forconstantas well. That's a nicer name imho.yanokwa commentedon May 9, 2018
And it looks like
hiddenis really a new question to prevent the missing calculation warning. Sounds like the things we used to do in the dark days. Would it be reasonable to get pyxforms to make this more of a macro (so if you use it, it's acalculatewith.as a calculation?MartijnR commentedon May 9, 2018
I think adding the macro would add complexity and am not sure what it would accomplish. There currently is no XForms syntax associated with
type=hidden. It seems to just leave out the calculate requirement, so it's useful to store constants and provides a cleaner XForm output.current for type=hidden with a default:
vs
Sidenote: I just noticed that calculate="." does not actually pass ODK Validate, so currently we'd have to do something like
calculate="once(2)"if we'd like to use a default with a type=calculation (or use Enketo Validate or fix the dependency cycle error in ODK Validate). See hidden5.xml.txt -> https://validate.enketo.orgyanokwa commentedon May 9, 2018
Fair points. I'm OK with documenting
hiddenwith an alias ofconstant(or ratherconstantwith an alias ofhidden). What say ye, @lognaturel?tiritea commentedon Mar 23, 2019
Precisely. The purpose of hidden - in my view - is precisely as a means to insert a constant (default) into the XForms instance XML, as @MartijnR noted. Having to do this using a redundant calculate is inefficient - it'll become yet another calculation to worry about re-evaluating whenever things change...
I actually like hidden exactly the way it is! :-) Although the term 'constant' might indeed be a bit more descriptive.
[well, not exactly the way it is... it would be even better to have a means to insert a constant element into the instance XML without the need for a binding, which you can have in raw XForms. But maybe that's asking for way too much].
MartijnR commentedon Jun 8, 2020
Edited the description of the 'hidden' question type, #116
MartijnR commentedon Jun 9, 2020
So, this thread was about 2 different things, one of which is addressed.
The remaining is a suggestion about adding a new 'exclude' column. Will update the title.
[-]Document `hidden` question type[/-][+]Add 'exclude' column to exclude questions from output[/+]MartijnR commentedon Jun 9, 2020
Might be nice to support exclude on groups and repeats as well.
Merge pull request #194 from XLSForm/fix/hidden-type
jnm commentedon Aug 25, 2020
In case it's helpful for reference: there's an undocumented—except for some SurveyCTO documentation and sample forms—
disabledcolumn that causes pyxform to completely discard rows of the input XLSForm spreadsheet. I found this while troubleshooting a problem with a KoBo library that didn't supportdisabled.It looks like the feature was added in 2011 but incurred a warning later the same year.