ODK 2.0 Pick values in a Linked survey other than instance name

Hi ODK Family,
Can someone help me understand how I can reference a variable other than the instance name in the parent survey form and access it in the child form using linked tables?
For example:
I have a Household form which midway opens the child form to enter data about the children in the house. However I would like to reference some variables from the household form other than the household ID which I will use to calculate something in the child form.
I have been frustrated for weeks now without finding any information on the web on how to solve this. Is it even possible?
Please help!
Many thanks,
ODK is great and is changing research in Africa.

Regards,
Enos

One way that you could solve this problem is to include the field that you
want from the household form in the model worksheet of the child form. You
could then pass in the values you want to use in the child form via the
auxillaryHash field for your linked table query.

The attached zip file has an example of how to do this. This example is
based off of rev 126. The two forms in this zip file are
household_new.xlsx and household_member.xlsx. Household_new is the parent
form and household_member is the child form. In particular, you will want
to look at the linked_members query in the queries worksheet of the
household_new form. Here I am passing in the household_id and num_rooms to
the household_member form. Later in the household_member form, I am using
the value of the num_rooms in a constraint for the roomNum prompt.

If you have other questions, don't hesitate to ask.

Clarice

parent_child_rev126.zip (42.5 KB)

ยทยทยท On Thu, Oct 1, 2015 at 2:56 AM, wrote:

Hi ODK Family,
Can someone help me understand how I can reference a variable other than
the instance name in the parent survey form and access it in the child form
using linked tables?
For example:
I have a Household form which midway opens the child form to enter data
about the children in the house. However I would like to reference some
variables from the household form other than the household ID which I will
use to calculate something in the child form.
I have been frustrated for weeks now without finding any information on
the web on how to solve this. Is it even possible?
Please help!
Many thanks,
ODK is great and is changing research in Africa.

Regards,
Enos

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like

Also, if you have two or more forms for the same table, each of them can
specify different instance_name fields.
This might be useful in other situations as you develop your survey.

ยทยทยท On Fri, Oct 2, 2015 at 12:24 PM, clarice larson wrote:

One way that you could solve this problem is to include the field that you
want from the household form in the model worksheet of the child form. You
could then pass in the values you want to use in the child form via the
auxillaryHash field for your linked table query.

The attached zip file has an example of how to do this. This example is
based off of rev 126. The two forms in this zip file are
household_new.xlsx and household_member.xlsx. Household_new is the parent
form and household_member is the child form. In particular, you will want
to look at the linked_members query in the queries worksheet of the
household_new form. Here I am passing in the household_id and num_rooms to
the household_member form. Later in the household_member form, I am using
the value of the num_rooms in a constraint for the roomNum prompt.

If you have other questions, don't hesitate to ask.

Clarice

On Thu, Oct 1, 2015 at 2:56 AM, enosande44@gmail.com wrote:

Hi ODK Family,
Can someone help me understand how I can reference a variable other than
the instance name in the parent survey form and access it in the child form
using linked tables?
For example:
I have a Household form which midway opens the child form to enter data
about the children in the house. However I would like to reference some
variables from the household form other than the household ID which I will
use to calculate something in the child form.
I have been frustrated for weeks now without finding any information on
the web on how to solve this. Is it even possible?
Please help!
Many thanks,
ODK is great and is changing research in Africa.

Regards,
Enos

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

Hi Clarice,
Had a lot on my plate and never got back to you.
First of all let me start by saying thanks a lot for your response as it
really helped me.
Second, now I am using rev 204 and it appears that if you have a second
linked table which adds more information to the children in the household
(for example if you have an education form) and you want to bring along a
value from the parent form (not the children form), the system does not
bring this value and I think its because there is no such variable in the
children form (which happens to have the same table id as the education
form). I am not sure I am making much sense so let me illustrate further
below;

tables/household/forms/household - This is the household form
tables/children/forms/children - This is the children form
tables/children/forms/education - This is the education form

Now I want the system to pick a value (household total score) from the
household form along with the household ID when entering in the education
form. The problem is that the children entered during the children form
entry are not displayed when entering the education form and I suspect that
this is either because of the selection, selectionArgs, or the
auxillaryHash. See my queries sheet below;

query_name query_type linked_form_id linked_table_id selection
selectionArgs auxillaryHash
linked_children linked_table children children household_id = ? [
data('household_id') ]
'household_id='+opendatakit.encodeURIDataElement('household_id')
linked_education linked_table education children household_id = ? and
final_score = ?
[ data('household_id'), data('final_score') ]
'household_id='+opendatakit.encodeURIDataElement('household_id')+'&final_score='+opendatakit.encodeURIDataElement('final_score')
Please advise where i could be wrong here.
Many thanks,

Enos

ยทยทยท On Friday, 2 October 2015 22:24:41 UTC+3, clarice larson wrote: > > One way that you could solve this problem is to include the field that you > want from the household form in the model worksheet of the child form. You > could then pass in the values you want to use in the child form via the > auxillaryHash field for your linked table query. > > The attached zip file has an example of how to do this. This example is > based off of rev 126. The two forms in this zip file are > household_new.xlsx and household_member.xlsx. Household_new is the parent > form and household_member is the child form. In particular, you will want > to look at the linked_members query in the queries worksheet of the > household_new form. Here I am passing in the household_id and num_rooms to > the household_member form. Later in the household_member form, I am using > the value of the num_rooms in a constraint for the roomNum prompt. > > If you have other questions, don't hesitate to ask. > > Clarice > > > On Thu, Oct 1, 2015 at 2:56 AM, <enosa...@gmail.com > wrote: > >> Hi ODK Family, >> Can someone help me understand how I can reference a variable other than >> the instance name in the parent survey form and access it in the child form >> using linked tables? >> For example: >> I have a Household form which midway opens the child form to enter data >> about the children in the house. However I would like to reference some >> variables from the household form other than the household ID which I will >> use to calculate something in the child form. >> I have been frustrated for weeks now without finding any information on >> the web on how to solve this. Is it even possible? >> Please help! >> Many thanks, >> ODK is great and is changing research in Africa. >> >> Regards, >> Enos >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ODK Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to opendatakit-developers+unsubscribe@googlegroups.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > >

It seems that for the second linked query you actually want to retrieve all
of the children with the same household_id, but you want to initialize one
field after the children of that household are retrieved. You are correct
in that if you want to initialize the final_score field of the children
table with the value of final_score from the household table, then the
final_score field must be added to the children table. If you want to
accomplish what I've described, you will want to do the following for the
linked_education query.
linked_education linked_table education children household_id = ? [
data('household_id')]
'household_id='+opendatakit.encodeURIDataElement('household_id')+'&final_score='+opendatakit.encodeURIDataElement('final_score')
Feel
free to send me your forms for further clarification if needed.

Clarice

ยทยทยท On Tue, Oct 18, 2016 at 11:37 PM, Enos Sande wrote:

Hi Clarice,
Had a lot on my plate and never got back to you.
First of all let me start by saying thanks a lot for your response as it
really helped me.
Second, now I am using rev 204 and it appears that if you have a second
linked table which adds more information to the children in the household
(for example if you have an education form) and you want to bring along a
value from the parent form (not the children form), the system does not
bring this value and I think its because there is no such variable in the
children form (which happens to have the same table id as the education
form). I am not sure I am making much sense so let me illustrate further
below;

tables/household/forms/household - This is the household form
tables/children/forms/children - This is the children form
tables/children/forms/education - This is the education form

Now I want the system to pick a value (household total score) from the
household form along with the household ID when entering in the education
form. The problem is that the children entered during the children form
entry are not displayed when entering the education form and I suspect that
this is either because of the selection, selectionArgs, or the
auxillaryHash. See my queries sheet below;

query_name query_type linked_form_id linked_table_id selection
selectionArgs auxillaryHash
linked_children linked_table children children household_id = ? [
data('household_id') ]
'household_id='+opendatakit.encodeURIDataElement('household_id')
linked_education linked_table education children household_id = ?
and final_score = ?
[ data('household_id'), data('final_score') ]
'household_id='+opendatakit.encodeURIDataElement('household_id')+'&final_score='+opendatakit.encodeURIDataElement('final_score')
Please advise where i could be wrong here.
Many thanks,

Enos

On Friday, 2 October 2015 22:24:41 UTC+3, clarice larson wrote:

One way that you could solve this problem is to include the field that
you want from the household form in the model worksheet of the child form.
You could then pass in the values you want to use in the child form via the
auxillaryHash field for your linked table query.

The attached zip file has an example of how to do this. This example is
based off of rev 126. The two forms in this zip file are
household_new.xlsx and household_member.xlsx. Household_new is the parent
form and household_member is the child form. In particular, you will want
to look at the linked_members query in the queries worksheet of the
household_new form. Here I am passing in the household_id and num_rooms to
the household_member form. Later in the household_member form, I am using
the value of the num_rooms in a constraint for the roomNum prompt.

If you have other questions, don't hesitate to ask.

Clarice

On Thu, Oct 1, 2015 at 2:56 AM, enosa...@gmail.com wrote:

Hi ODK Family,
Can someone help me understand how I can reference a variable other than
the instance name in the parent survey form and access it in the child form
using linked tables?
For example:
I have a Household form which midway opens the child form to enter data
about the children in the house. However I would like to reference some
variables from the household form other than the household ID which I will
use to calculate something in the child form.
I have been frustrated for weeks now without finding any information on
the web on how to solve this. Is it even possible?
Please help!
Many thanks,
ODK is great and is changing research in Africa.

Regards,
Enos

--
You received this message because you are subscribed to the Google
Groups "ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.