Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'exclude' column to exclude questions from output #116

Open
tinok opened this issue Apr 24, 2018 · 12 comments
Open

Add 'exclude' column to exclude questions from output #116

tinok opened this issue Apr 24, 2018 · 12 comments

Comments

@tinok
Copy link
Member

tinok commented Apr 24, 2018

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.

Any thoughts @MartijnR @yanokwa ?

@tinok
Copy link
Member Author

tinok commented 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 as TRUE.

@MartijnR
Copy link
Contributor

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
Copy link
Contributor

yanokwa commented 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
Copy link
Contributor

MartijnR commented 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 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.

@yanokwa
Copy link
Contributor

yanokwa commented May 9, 2018

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?

@MartijnR
Copy link
Contributor

MartijnR commented 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:

<one>default</one>
<bind nodeset="/hidden/one" type="string"/>

vs

<two>default</two>
<bind nodeset="/hidden/two" type="string"  calculate="." />

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

@yanokwa
Copy link
Contributor

yanokwa commented May 9, 2018

Fair points. I'm OK with documenting hidden with an alias of constant (or rather constant with an alias of hidden). What say ye, @lognaturel?

@tiritea
Copy link

tiritea commented Mar 23, 2019

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].

@MartijnR
Copy link
Contributor

MartijnR commented Jun 8, 2020

  • Slightly elaborate on current description of 'hidden' in docs

@MartijnR
Copy link
Contributor

MartijnR commented 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.

@MartijnR MartijnR changed the title Document hidden question type Add 'exclude' column to exclude questions from output Jun 9, 2020
@MartijnR
Copy link
Contributor

MartijnR commented Jun 9, 2020

Might be nice to support exclude on groups and repeats as well.

@MartijnR MartijnR removed their assignment Jun 9, 2020
lognaturel added a commit that referenced this issue Jun 24, 2020
Edited the description of the 'hidden' question type, #116
@jnm
Copy link
Member

jnm commented Aug 25, 2020

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.

It looks like the feature was added in 2011 but incurred a warning later the same year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants