Getting a nodeset of responses, but not from a repeat group

I'm trying to construct a nodeset from responses (for use in functions like min() and max()).

According to the docs:

Nodesets can also be created by joining two or more nodes with pipes: /data/age | /data/name.

But when I try this, I get an error.

Form:

type    		name	label	calculation
integer		n1	N1	
integer		n2	N2	
integer		n3	N3	
calculate	max		max(/data/n1 | /data/n2 | /data/n3)
note		maxnote	Max: ${max}	

max-test.xlsx (28.0 KB)

Error:

 b'ODK Validate Errors:\n' + ErrorCleaner.odk_validate(stderr).encode('utf-8'))
pyxform.validators.odk_validate.ODKValidateError: b"ODK Validate Errors:\n>> Something broke the parser. See above for a hint.\nError evaluating field 'max': The problem was located in calculate expression for ${max}\nXPath evaluation: unsupported construct [max(${n1} | ${n2} | ${n3})]\nCaused by: org.javarosa.xpath.XPathUnsupportedException: The problem was located in calculate expression for ${max}\nXPath evaluation: unsupported construct [max(${n1} | ${n2} | ${n3})]\n\t... 10 more\n\nResult: Invalid"

Note that something weird is happening here in the error, too. The error is referencing the calculation function with the dollar-sign-curly-bracket syntax: unsupported construct [max(${n1} | ${n2} | ${n3})].

I tried this first (and it didn't work), but then changed it to the /data/n1 syntax. No change in error output. I don't know if that is meaningful.

Hi Adam (or anyone else who has dealt with this),

Realizing I'm reviving a very dead thread here, but am running into the exact same issue. Did you ever have any luck resolving this?

Thanks!

The calculation should be max(${n1}, ${n2}, ${n3})
max-test.xlsx (5.4 KB)

@jgraham does that help you? If not please attach your form and describe the problem.

1 Like

Yep, that does it - thanks so much! I'll try to update the docs for the functions to make clear they can be called this way if I get some time soon!

Really appreciate it!