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

If statements with incorrect number of parameters #480

Closed
joeflack4 opened this issue Aug 22, 2019 · 5 comments
Closed

If statements with incorrect number of parameters #480

joeflack4 opened this issue Aug 22, 2019 · 5 comments

Comments

@joeflack4
Copy link
Contributor

Problem description

An issue in which if() statement is used without the correct number of parameters (e.g. 4+ params).

Steps to reproduce the problem

  1. Create an XLSForm and use an erroneous if statement with too many parameters, e.g. an arbitrary example: if(1=0, 1, 0, 1). Or use the attached form.
  2. Try to run ODK Validate on this form. The issue isn't caught.

Expected behavior

The error is caught and an error message is presented.

Attachments

FQCSBaseline-V22-20190814-jef.xlsx

@lognaturel lognaturel transferred this issue from getodk/validate Sep 6, 2019
@lognaturel
Copy link
Member

lognaturel commented Sep 6, 2019

Thanks, @joeflack4! JavaRosa does the parameter count checking so that's why I moved the issue here. I think this might be a little more complex than what you've described, though.

I just took a quick look and the if function definition does verify that there are exactly three arguments. Did you actually try a form with the arbitrary example you list and could you attach it?

I haven't looked at your form in great detail but I see that there a lot of ifs. Which is the one with the problem? Is it possible that it's on a node that's not relevant before data is entered?

@joeflack4
Copy link
Contributor Author

Oh, cool. I didn't know you could move issues to a different repo o.O

Hmm, sorry Hélène. I couldn't replicate. And I don't even remember why I included the whole form, rather than just an example, since this is pretty much a one-liner. In any event, from what I remember, such an if() statement with more than 3 parameters was able to be converted (somehow)... Perhaps it was nested or who knows. If I find it again I'll show it to you. From what I remember, we experienced a runtime error in Collect.

So until I come across this again, I think we should close this issue.


Also, what about the following issue I posted in ODK Validate; it seems to be similar to this one as well: getodk/validate#60

@priusak
Copy link

priusak commented Sep 6, 2019 via email

@lognaturel
Copy link
Member

lognaturel commented Sep 6, 2019

I didn't know you could move issues to a different repo

It's a new-ish feature! 🚀

I couldn't replicate.

That's good news! I tried to replicate what I described with relevance and couldn't get a badly-formed if through. Definitely do re-open if you can provide the if statement that fails and the exact runtime error you get.

@joeflack4
Copy link
Contributor Author

@lognaturel Oh cool. Uhh, is @priusak a new feature too, haha? Looks like a bot.

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

3 participants