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

Improve constraint usability through functions like inrange #75

Closed
lognaturel opened this issue Jan 17, 2017 · 5 comments
Closed

Improve constraint usability through functions like inrange #75

lognaturel opened this issue Jan 17, 2017 · 5 comments

Comments

@lognaturel
Copy link
Member

There are constraint functions that could help form designers build better forms more quickly. For example, @chrislrobert got an ask for something like Stata's inrange() function which would be easier to use than a combination of <= and >=. The user who made the ask has had to recover from several logic bugs introduced in complex constraint functions. I'm sure that kind of issue is pretty common and is worth addressing.

One option would be to add those as custom XPath functions to this spec but as they only add user-facing convenience, perhaps they could instead be added at the XLSForm level as syntactic sugar for the comparison operators.

@mberg
Copy link

mberg commented Jan 17, 2017 via email

@lognaturel
Copy link
Member Author

I agree we should discuss what the actual functions would be and what they correspond to. The Stata example was what that particular person mentioned. Supporting Excel functions seems like a good idea but I think this is the complete list and that there is no convenience function for range.

In general, though, does the idea of doing some of this at the XLSForm level appeal to you? If so, I'll file over there. @chrislrobert, I can't remember, were there more of these you heard would be useful?

@chrislrobert
Copy link

chrislrobert commented Jan 17, 2017 via email

@MartijnR
Copy link
Contributor

MartijnR commented Jan 17, 2017

I'm all for adding some of these convenience functions on the XLSForm side and leaving them out of XForms. Something similar is also happening with the new GUI form builders that include formula builders (i.e. creating simple shortcuts in the UI that produce complex valid XPath expressions in the background).

Two advantages of choosing the XLSForm route, when it makes sense, is that we stay closer to XForms 1.0/1 and to CommCare (who do not seem to add custom functions) and there is no risk getting in trouble with function name collisions (in particular because we sort of decided not to namespace custom XPath functions).

(FWIW, Enketo does similar processing of some custom functions such as indexed-repeat() to re-write them as pure XPath 1.0 before evaluating them.)

@lognaturel
Copy link
Member Author

Awesome! Let's move the discussion over to XLSForm/xlsform.github.io#78 then.

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

4 participants