Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jr:choice-name parameters are not right #174

Open
lognaturel opened this issue Apr 4, 2018 · 2 comments
Open

jr:choice-name parameters are not right #174

lognaturel opened this issue Apr 4, 2018 · 2 comments

Comments

@lognaturel
Copy link
Member

Everyone's favorite function, jr:choice-name, seems to be documented with arguments flipped. It should be jr:choice-name(node node, string value) I believe. Validate and Collect agree with that.

@MartijnR
Copy link
Contributor

MartijnR commented Apr 4, 2018

Oops, yes!

@lognaturel
Copy link
Member Author

lognaturel commented Sep 12, 2019

Unfortunately, I think this is not quite correct. I think where I got this from is that the typical call from XLSForm looks like jr:choice-name(${my_select_node}, '${my_select_node}').

From the implementation, I see that the first argument is the value to get the choice name for and the second argument is a string path representing the question that defines the select choices.

Comment in JavaRosa:

arg 1: select value
arg 2: string xpath referring to origin question

I think the way that https://docs.opendatakit.org/form-operators-functions#jr:choice-name is written is relatively helpful. The first argument can either be a path or a literal choice name.

This function is really bizarre and we should probably introduce a better alternative and deprecate it. I can't really think of a usecase for passing a choice name other than the value of the select question so it seems it would be much simpler to just have a single argument.

@lognaturel lognaturel reopened this Sep 12, 2019
@lognaturel lognaturel changed the title jr:choice-name parameters are flipped jr:choice-name parameters are not right Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants