Skip to content

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

Open

Description

@tinok

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 ?

Activity

  1. tinok commented on Apr 24, 2018

    @tinok
    ContributorAuthor

    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.

  2. MartijnR commented on Apr 24, 2018

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

  3. yanokwa commented on May 9, 2018

    @yanokwa
    Contributor

    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?

  4. MartijnR commented on May 9, 2018

    @MartijnR
    Contributor

    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.

  5. yanokwa commented on May 9, 2018

    @yanokwa
    Contributor

    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?

  6. MartijnR commented on May 9, 2018

    @MartijnR
    Contributor

    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

  7. yanokwa commented on May 9, 2018

    @yanokwa
    Contributor

    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?

  8. tiritea commented on Mar 23, 2019

    @tiritea

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

  9. MartijnR commented on Jun 8, 2020

    @MartijnR
    Contributor
    • Slightly elaborate on current description of 'hidden' in docs
  10. self-assigned this
    on Jun 8, 2020
  11. MartijnR commented on Jun 9, 2020

    @MartijnR
    Contributor

    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.

  12. changed the title [-]Document `hidden` question type[/-] [+]Add 'exclude' column to exclude questions from output[/+] on Jun 9, 2020
  13. MartijnR commented on Jun 9, 2020

    @MartijnR
    Contributor

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

  14. removed their assignment
    on Jun 9, 2020
  15. added a commit that references this issue on Jun 24, 2020
  16. jnm commented on Aug 25, 2020

    @jnm

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions