# Min function syntax issue

Hi -

I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset).

This is what I currently have set up:

• value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number
• the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6)
• the final field, mon_reg, calculates min(mon_reg_string)

When I display mon_reg, I show NaN.

Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error.

Thanks,
Vina

Hi Vina,

It'd help if you could provide the XML of a form with just these
prompts so others could help track down the issue.

Yaw

ยทยทยท -- Need ODK services? Go to http://nafundi.com for form design, data cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 11:21 AM, vina.chhaya@gmail.com wrote:

Hi -

I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset).

This is what I currently have set up:

• value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number
• the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6)
• the final field, mon_reg, calculates min(mon_reg_string)

When I display mon_reg, I show NaN.

Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error.

Thanks,
Vina

## --

You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

Good point - sorry, I am new to this. Here it is:

value 1:

value 2:

value 3:

value 4:

value 5:

value 6:

concatenating all values into a string:

calculating min and display of min:

``````    <input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">
<label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg_string"/></label></input>
``````
ยทยทยท On Tuesday, July 16, 2013 4:00:35 PM UTC-4, Yaw Anokwa wrote: > Hi Vina, > > > > It'd help if you could provide the XML of a form with just these > > prompts so others could help track down the issue. > > > > Yaw > > -- > > Need ODK services? Go to http://nafundi.com for form design, data > > cleaning, custom reporting, and software development for ODK. > > > > On Tue, Jul 16, 2013 at 11:21 AM, wrote: > > > Hi - > > > > > > I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset). > > > > > > This is what I currently have set up: > > > > > > - value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number > > > - the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6) > > > - the final field, mon_reg, calculates min(mon_reg_string) > > > > > > When I display mon_reg, I show NaN. > > > > > > Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error. > > > > > > Thanks, > > > Vina > > > > > > -- > > > -- > > > Post: opendatakit@googlegroups.com > > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > --- > > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > >

Sorry, the score display output value was wrong below. It should be mon_reg and not mon_reg_string:

``````   <input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">
<label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg"/></label></input>
``````
ยทยทยท On Tuesday, July 16, 2013 4:45:33 PM UTC-4, vina....@gmail.com wrote: > Good point - sorry, I am new to this. Here it is: > > > > value 1: > > > > > > value 2: > > > > > > value 3: > > > > > > value 4: > > > > > > value 5: > > > > > > value 6: > > > > > > concatenating all values into a string: > > > > > > calculating min and display of min: > > > > > > > > > > Score for 9.1 Register Score (lowest) is: > > > > On Tuesday, July 16, 2013 4:00:35 PM UTC-4, Yaw Anokwa wrote: > > > Hi Vina, > > > > > > > > > > > > It'd help if you could provide the XML of a form with just these > > > > > > prompts so others could help track down the issue. > > > > > > > > > > > > Yaw > > > > > > -- > > > > > > Need ODK services? Go to http://nafundi.com for form design, data > > > > > > cleaning, custom reporting, and software development for ODK. > > > > > > > > > > > > On Tue, Jul 16, 2013 at 11:21 AM, wrote: > > > > > > > Hi - > > > > > > > > > > > > > > I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset). > > > > > > > > > > > > > > This is what I currently have set up: > > > > > > > > > > > > > > - value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number > > > > > > > - the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6) > > > > > > > - the final field, mon_reg, calculates min(mon_reg_string) > > > > > > > > > > > > > > When I display mon_reg, I show NaN. > > > > > > > > > > > > > > Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error. > > > > > > > > > > > > > > Thanks, > > > > > > > Vina > > > > > > > > > > > > > > -- > > > > > > > -- > > > > > > > Post: opendatakit@googlegroups.com > > > > > > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > > > > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > > > > > > > > > --- > > > > > > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > > >

Vina,

What I meant was a complete but small (say a three question) XForm
that has the problem.

Yaw

ยทยทยท -- Need ODK services? Go to http://nafundi.com for form design, data cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 1:50 PM, vina.chhaya@gmail.com wrote:

Sorry, the score display output value was wrong below. It should be mon_reg and not mon_reg_string:

``````   <input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">
<label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg"/></label></input>
``````

On Tuesday, July 16, 2013 4:45:33 PM UTC-4, vina....@gmail.com wrote:

Good point - sorry, I am new to this. Here it is:

value 1:

value 2:

value 3:

value 4:

value 5:

value 6:

concatenating all values into a string:

calculating min and display of min:

``````  <bind nodeset="/SMS_16July_2/Monitoring/Registers/mon_reg_display" readonly="true()" relevant="selected(/SMS_16July_2/st_cc,'9')" type="string"/>

<input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">

<label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg_string"/></label></input>
``````

On Tuesday, July 16, 2013 4:00:35 PM UTC-4, Yaw Anokwa wrote:

Hi Vina,

It'd help if you could provide the XML of a form with just these

prompts so others could help track down the issue.

Yaw

--

Need ODK services? Go to http://nafundi.com for form design, data

cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 11:21 AM, vina.chhaya@gmail.com wrote:

Hi -

I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset).

This is what I currently have set up:

• value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number
• the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6)
• the final field, mon_reg, calculates min(mon_reg_string)

When I display mon_reg, I show NaN.

Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error.

Thanks,

Vina

--

--

You received this message because you are subscribed to the Google Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

## --

You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

Here are the example lines. Let me know if anyone can help! The min function does not appear to work. Thanks!

Score for 9.1 Register Score (lowest) is:

Hi Vina,

I've filed this at
core team to track down. Please star that issue to get updates.

Yaw

ยทยทยท -- Need ODK services? Go to http://nafundi.com for form design, data cleaning, custom reporting, and software development for ODK.

On Tue, Jul 23, 2013 at 3:55 PM, vina.chhaya@gmail.com wrote:

Here are the example lines. Let me know if anyone can help! The min function does not appear to work. Thanks!

Score for 9.1 Register Score (lowest) is:

On Tuesday, July 16, 2013 4:55:06 PM UTC-4, Yaw Anokwa wrote:

Vina,

What I meant was a complete but small (say a three question) XForm

that has the problem.

Yaw

--

Need ODK services? Go to http://nafundi.com for form design, data

cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 1:50 PM, vina.chhaya@gmail.com wrote:

Sorry, the score display output value was wrong below. It should be mon_reg and not mon_reg_string:

``````   <input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">
``````
``````      <label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg"/></label></input>
``````

On Tuesday, July 16, 2013 4:45:33 PM UTC-4, vina....@gmail.com wrote:

Good point - sorry, I am new to this. Here it is:

value 1:

value 2:

value 3:

value 4:

value 5:

value 6:

concatenating all values into a string:

calculating min and display of min:

``````  <bind nodeset="/SMS_16July_2/Monitoring/Registers/mon_reg_display" readonly="true()" relevant="selected(/SMS_16July_2/st_cc,'9')" type="string"/>
``````
``````    <input ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">
``````
``````      <label>Score for 9.1 Register Score (lowest) is: <output value="/SMS_16July_2/Monitoring/Registers/mon_reg_string"/></label></input>
``````

On Tuesday, July 16, 2013 4:00:35 PM UTC-4, Yaw Anokwa wrote:

Hi Vina,

It'd help if you could provide the XML of a form with just these

prompts so others could help track down the issue.

Yaw

--

Need ODK services? Go to http://nafundi.com for form design, data

cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 11:21 AM, vina.chhaya@gmail.com wrote:

Hi -

I am trying to figure out the correct syntax for calculating the minimum of a set of values that are calculated using if/then/else logic and I keep getting NaN when I use min(nodeset).

This is what I currently have set up:

• value 1, value 2, ... , value 6 are all stored as calculate fields with the constraint to store as a number
• the field mon_reg_string concatenates value 1 through value 6 into a string (value 1, value2, ... , value6)
• the final field, mon_reg, calculates min(mon_reg_string)

When I display mon_reg, I show NaN.

Any suggestions on how to store the minimum of these 6 calculated values and then display? If this cannot be done, I would have to resort to a manual entry of the lowest score after displaying all 6 values and would open the form up to a data entry error.

Thanks,

Vina

--

--

You received this message because you are subscribed to the Google Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

--

--

You received this message because you are subscribed to the Google Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

## --

You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.

This is not an error in JR -- the min() and max() functions are only valid
for numeric values.
These need to be type="int" or type="decimal"

Mitch

ยทยทยท On Tue, Jul 23, 2013 at 4:24 PM, Yaw Anokwa wrote:

Hi Vina,

I've filed this at
core team to track down. Please star that issue to get updates.

## Yaw

Need ODK services? Go to http://nafundi.com for form design, data
cleaning, custom reporting, and software development for ODK.

On Tue, Jul 23, 2013 at 3:55 PM, vina.chhaya@gmail.com wrote:

Here are the example lines. Let me know if anyone can help! The min
function does not appear to work. Thanks!

Score for 9.1 Register Score
(lowest) is:

On Tuesday, July 16, 2013 4:55:06 PM UTC-4, Yaw Anokwa wrote:

Vina,

What I meant was a complete but small (say a three question) XForm

that has the problem.

Yaw

--

Need ODK services? Go to http://nafundi.com for form design, data

cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 1:50 PM, vina.chhaya@gmail.com wrote:

Sorry, the score display output value was wrong below. It should be
mon_reg and not mon_reg_string:

``````   <input
``````

ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">

``````      <label>Score for 9.1 Register Score (lowest) is: <output
``````

value="/SMS_16July_2/Monitoring/Registers/mon_reg"/>

On Tuesday, July 16, 2013 4:45:33 PM UTC-4, vina....@gmail.com wrote:

Good point - sorry, I am new to this. Here it is:

value 1:

value 2:

value 3:

value 4:

value 5:

value 6:

concatenating all values into a string:

calculating min and display of min:

``````  <bind
``````

nodeset="/SMS_16July_2/Monitoring/Registers/mon_reg_display"
type="string"/>

``````    <input
``````

ref="/SMS_16July_2/Monitoring/Registers/mon_reg_display">

``````      <label>Score for 9.1 Register Score (lowest) is: <output
``````

value="/SMS_16July_2/Monitoring/Registers/mon_reg_string"/>

On Tuesday, July 16, 2013 4:00:35 PM UTC-4, Yaw Anokwa wrote:

Hi Vina,

It'd help if you could provide the XML of a form with just these

prompts so others could help track down the issue.

Yaw

--

Need ODK services? Go to http://nafundi.com for form design, data

cleaning, custom reporting, and software development for ODK.

On Tue, Jul 16, 2013 at 11:21 AM, vina.chhaya@gmail.com wrote:

Hi -

I am trying to figure out the correct syntax for calculating the
minimum of a set of values that are calculated using if/then/else logic and
I keep getting NaN when I use min(nodeset).

This is what I currently have set up:

• value 1, value 2, ... , value 6 are all stored as calculate
fields with the constraint to store as a number
• the field mon_reg_string concatenates value 1 through value 6
into a string (value 1, value2, ... , value6)
• the final field, mon_reg, calculates min(mon_reg_string)

When I display mon_reg, I show NaN.

Any suggestions on how to store the minimum of these 6
calculated values and then display? If this cannot be done, I would have to
resort to a manual entry of the lowest score after displaying all 6 values
and would open the form up to a data entry error.

Thanks,

Vina

--

--

You received this message because you are subscribed to the

To unsubscribe from this group and stop receiving emails from
it, send an email to opendatakit+unsubscribe@googlegroups.com.

.

--

--

Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it,

## --

Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send

## --

You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an