Check box

hi all,

this is my structure; i upload data using the phone into odk aggregate, and
i have writen code to get/*select *this data and *insert *in into the
second database..but the insert does not work if the odk collect checkboxes
are left *unchecked. *i have checkboxes in odk collect form, when the
form was uploaded into odk aggregate, the checkboxes created their own
tables respectively. the following is snapshot script of one of the
checkboxes:

$query3="select * from telemed_new_case_lesion_nature";
$result3 = mysql_query($query3) or die("Error 1" . mysql_error());
$num_rows3 = mysql_num_rows($result3) or die(mysql_error());

while($info=mysql_fetch_array($result3))
{
$lesion_nature=$info['VALUE'];

}

it's not clear what you are asking, but in the xforms data that
collect sends, it only sends the selected checkboxes. so for example,
if you have checkboxes for a through e and you select a, c, and d,
this is what is in the node you send: <select_prompt>a c
d</select_prompt>.

if you want all the potential options, look through the code and db
for where the aggregate parses the initial form. i'm not familiar with
the codebase so maybe others can chime in with pointers.

··· On Wed, Dec 21, 2011 at 06:17, Thapelo Khumomotse wrote: > hi all, > > this is my structure; i upload data using the phone into odk aggregate, and > i have writen code to get/select this data and insert in into the second > database..but the insert does not work if the odk collect checkboxes are > left unchecked. i have checkboxes in odk collect form, when the form was > uploaded into odk aggregate, the checkboxes created their own tables > respectively. the following is snapshot script of one of the checkboxes: > > > $query3="select * from telemed_new_case_lesion_nature"; > $result3 = mysql_query($query3) or die("Error 1" . mysql_error()); > $num_rows3 = mysql_num_rows($result3) or die(mysql_error()); > > while($info=mysql_fetch_array($result3)) > { > $lesion_nature=$info['VALUE']; > > }

I assume you have an ODK Aggregate running against either a MySQL or
PostgreSQL database.

And that your form has a multi-select widget (i.e., a ).

When you have a multi-select, if the user has not selected any choice,
there will be no record in the selected-choices table that Aggregate uses
to hold the choices chosen for a particular submission. A query against
that selected-choices table for this submission will therefore return no
results.

I'm not up on your scripting language, but I think this would cause an
error to be reported in your code snippet.

If you are joining tables, you would want to use an "outer join" against
the selected-choices table.

Mitch

··· On Wed, Dec 21, 2011 at 8:05 AM, Yaw Anokwa wrote:

it's not clear what you are asking, but in the xforms data that
collect sends, it only sends the selected checkboxes. so for example,
if you have checkboxes for a through e and you select a, c, and d,
this is what is in the node you send: <select_prompt>a c
d</select_prompt>.

if you want all the potential options, look through the code and db
for where the aggregate parses the initial form. i'm not familiar with
the codebase so maybe others can chime in with pointers.

On Wed, Dec 21, 2011 at 06:17, Thapelo Khumomotse thapelo.khumomotse@gmail.com wrote:

hi all,

this is my structure; i upload data using the phone into odk aggregate,
and
i have writen code to get/select this data and insert in into the second
database..but the insert does not work if the odk collect checkboxes are
left unchecked. i have checkboxes in odk collect form, when the form
was
uploaded into odk aggregate, the checkboxes created their own tables
respectively. the following is snapshot script of one of the checkboxes:

$query3="select * from telemed_new_case_lesion_nature";
$result3 = mysql_query($query3) or die("Error 1" . mysql_error());
$num_rows3 = mysql_num_rows($result3) or die(mysql_error());

while($info=mysql_fetch_array($result3))
{
$lesion_nature=$info['VALUE'];

}

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

hi all,

i have checkboxes, one of them is labeled "none", if "none" is checked
i do not want the others to be...but the others can be multi selected as
long as "none" is not selected.

please help

What do you need help with?

Is it a question about constructing a constraint to enforce that "none" is
the only item checked?

Or is is a question about accessing the underlying database tables on your
MySQL or PostgreSQL server?

Mitch

··· On Wed, Dec 21, 2011 at 11:02 PM, Thapelo Khumomotse < thapelo.khumomotse@gmail.com> wrote:

hi all,

i have checkboxes, one of them is labeled "none", if "none" is
checked i do not want the others to be...but the others can be multi
selected as long as "none" is not selected.

please help

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com