Skip to content

Select from repeat inside that same repeat transforms choice_filter expressions with current() #504

@lognaturel

Description

@lognaturel

Related to #503

Software and hardware versions

pyxform v1.3.3

Problem description

Select from repeat transforms choice_filter expressions with current().

Steps to reproduce the problem

Use current() in a choice_filter expression for a select from repeat inside that same repeat. Note that the behavior is correct when it's not a select from repeat or when it's a select from repeat not inside the same repeat.

    def test_explicit_choice_filter_with_current__passes_current_expression_through(self):
        xlsform_md = """
        | survey  |                      |        |         |                         |
        |         | type                 | name   | label   | choice_filter           |
        |         | select_one yes_no    | outer  | Yes?    | name = current()/../foo |
        |         | begin repeat         | repeat | Repeat  |                         |
        |         | select_one ${inner}  | dynamic| Dynamic | name = current()/../foo |
        |         | select_one yes_no    | inner  | Yes?    | name = current()/../foo |
        |         | end repeat           | repeat |         |                         |
        |         | select_one ${inner}  | dynamic| Dynamic | name = current()/../foo |
        | choices |                      |        |         |                         |
        |         | list_name            | name   | label   |                         |
        |         | yes_no               | yes    | Yes     |                         |
        |         | yes_no               | no     | No      |                         |
        """
        self.assertPyxformXform(
            name="data",
            debug=True,
            md=xlsform_md,
            xml__contains=[
                '<itemset nodeset="../../repeat[name = current()/../foo]">',
            ],
        )

Expected behavior

Expressions with current() should always be passed through.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ${} referencesRelated to pyxform reference variablesbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions