Skip to content

Reference to sibling in choice filter not correctly expanded in select from repeat inside that same repeat #505

@lognaturel

Description

@lognaturel

Related to #504

Software and hardware versions

pyxform v1.3.3

Problem description

Reference to sibling in choice filter not correctly expanded in select from repeat inside that same repeat.

Steps to reproduce the problem

Note that the expansion happens as expected with a select not from repeat.

def test_reference_to_same_repeat_in_choice_filter__produces_current_expression(self):
    xlsform_md = """
    | survey  |                      |         |         |                         |
    |         | type                 | name    | label   | choice_filter           |
    |         | begin repeat         | repeat  | Repeat  |                         |
    |         | text                 | sibling | Sibling |                         |        
    |         | select_one ${sibling}| dynamic | Dynamic | name = ${sibling}       |
    |         | select_one yes_no    | inner   | Yes?    | name = ${sibling}       |
    |         | end repeat           | repeat  |         |                         |
    | 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()/../sibling ]">',
        ],
    )

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