Skip to content

Invalid Entity declaration placement when Entity expression has reference in repeat and deeper one outside repeat #822

@lognaturel

Description

@lognaturel

There's an issue around how the deepest container reference gets used for Entity declaration placement. I don't think it's critical to fix now or maybe at all but do want to document, especially to help us if a user does run into it. I think the issue is that we should only be picking the deepest ref within the deepest scope boundary. I believe Validate will always catch the issue but the error is unhelpful (getodk/javarosa#700):

Error evaluating field 'label' (${g1}[1]/g2[1]/meta[1]/entity[1]/label[1]): The problem was located in Calculate expression for ${label}
XPath evaluation: type mismatch
This field is repeated:

${r1}[1]/q_in[1];${r1}[2]/q_in[1]

You may need to use the indexed-repeat() function to specify which value you want.

Small reproduction with label: in-out.xlsx

The problem can manifest with any Entity expression (entity_id, create_if, etc...). Putting a save_to on in forces the declaration in r1. Removing the double group nesting solves the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions