Skip to content

Wrong reference when building select one from repeat inside that repeat #503

@lognaturel

Description

@lognaturel

Software and hardware versions

pyxform v1.3.3

Problem description

When trying to use a select one from repeat inside the current repeat, the wrong reference is produced. It should be ../../repeat but instead is ../.

Steps to reproduce the problem

type name label choice_filter appearance relevance calculation
begin_repeat pet Pet   field-list    
calculate pos         position(..)
select_one ${animal_type} animal_select Select the animal type. If not in the list, type below. position() != current()/../pos and animal_type != ''      
text animal_type Animal type     ${animal_select} = ''  
end_repeat pet          

XLSForm

    def test_choice_from_previous_repeat_in_current_repeat__parents_out_to_repeat(self):
        xlsform_md = """
        | survey  |                           |                           |                          |
        |         | type                      | name                      | label                    |
        |         | begin repeat              | pet                       | Pet                      |
        |         | select_one ${animal_type} | animal_select             | Select the animal type   |
        |         | text                      | animal_type               | Specify the animal type  |
        |         | end repeat                | pet                       |                          |
        """
        self.assertPyxformXform(
            name="data",
            debug=True,
            md=xlsform_md,
            xml__contains=[
                '<itemset nodeset="../../pet">',
            ],
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions