Tables v2 - reference data from another table

I have 2 forms - stock and movement

stock details a stock request
movement details a list of items (1 - x) going in or out for that stock
request

I have successfully listed the detail of the stock request using the
standard data command as extracted from the examples

$('#FIELD_1').text(data.get('stock_id'));
$('#FIELD_2').text(data.get('reference'));
$('#FIELD_3').text(data.get('date'));
$('#FIELD_4').text(data.get('location_latitude'));
$('#FIELD_5').text(data.get('location_longitude'));

I now need to display the list of movements from the table and am unsure
how to request the data. I am thinking something like this below..but would
like some guidance if possible before going on a trial and error process

for (var i = 0; i < [data('movement'),'uniqueid'].getCount(); i++) {

    itemHeading.text(data('movement').getData(i, 'stock_id'));

}

any help much appreciated

thanks
andrew

Please only ask a question on either opendatakit@ or opendatakit-developers@
and do not repeat your questions.

This question is more appropriate for the opendatakit@ list.

··· On Mon, Dec 14, 2015 at 7:22 AM, Andrew de Klerk wrote:

I have 2 forms - stock and movement

stock details a stock request
movement details a list of items (1 - x) going in or out for that stock
request

I have successfully listed the detail of the stock request using the
standard data command as extracted from the examples

$('#FIELD_1').text(data.get('stock_id'));
$('#FIELD_2').text(data.get('reference'));
$('#FIELD_3').text(data.get('date'));
$('#FIELD_4').text(data.get('location_latitude'));
$('#FIELD_5').text(data.get('location_longitude'));

I now need to display the list of movements from the table and am unsure
how to request the data. I am thinking something like this below..but would
like some guidance if possible before going on a trial and error process

for (var i = 0; i < [data('movement'),'uniqueid'].getCount(); i++) {

    itemHeading.text(data('movement').getData(i, 'stock_id'));

}

any help much appreciated

thanks
andrew

--
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

Please follow Mitch's suggestion in the future. As to the answer to your
question, your reasoning is close. You will actually want to use the query
function of the control object to query the contents of another table. A
good example to look at is the Tea Time in Benin demo app in the jan2015
branch of the app-designer repo. In particular, you will want to take a
look at the app/tables/Tea_houses/js/Tea_houses_detail.js. In this file,
you can see that the Tea_types and Tea_inventory tables are queried. The
control.query call returns a data object. To see the control and data
functions available to you take a look at
app/framework/tables/js/control.js
and app-designer/app/framework/tables/js/data.js in the app-designer repo.

Clarice

··· On Mon, Dec 14, 2015 at 10:17 AM, Mitch Sundt wrote:

Please only ask a question on either opendatakit@ or
opendatakit-developers@ and do not repeat your questions.

This question is more appropriate for the opendatakit@ list.

On Mon, Dec 14, 2015 at 7:22 AM, Andrew de Klerk <andrew.deklerk@gmail.com wrote:

I have 2 forms - stock and movement

stock details a stock request
movement details a list of items (1 - x) going in or out for that stock
request

I have successfully listed the detail of the stock request using the
standard data command as extracted from the examples

$('#FIELD_1').text(data.get('stock_id'));
$('#FIELD_2').text(data.get('reference'));
$('#FIELD_3').text(data.get('date'));
$('#FIELD_4').text(data.get('location_latitude'));
$('#FIELD_5').text(data.get('location_longitude'));

I now need to display the list of movements from the table and am unsure
how to request the data. I am thinking something like this below..but would
like some guidance if possible before going on a trial and error process

for (var i = 0; i < [data('movement'),'uniqueid'].getCount(); i++) {

    itemHeading.text(data('movement').getData(i, 'stock_id'));

}

any help much appreciated

thanks
andrew

--
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

--
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.

thank you. The duplicate post was clearly unintentional as the first post
did not appear automatically because I was not subscribed to the group.

so for clarification the opendatakit-developers@ is only for source code
development and the opendatakit@ is for user customisation, form designs
etc?

If I am still not able to continue following clarice's advice I will post
to opendatakit@

Andrew

··· On Monday, 14 December 2015 21:05:20 UTC+2, clarice larson wrote: > > Please follow Mitch's suggestion in the future. As to the answer to your > question, your reasoning is close. You will actually want to use the query > function of the control object to query the contents of another table. A > good example to look at is the Tea Time in Benin demo app in the jan2015 > branch of the app-designer repo. In particular, you will want to take a > look at the app/tables/Tea_houses/js/Tea_houses_detail.js. In this file, > you can see that the Tea_types and Tea_inventory tables are queried. The > control.query call returns a data object. To see the control and data > functions available to you take a look at > app/framework/tables/js/control.js > and app-designer/app/framework/tables/js/data.js in the app-designer repo. > > Clarice > > On Mon, Dec 14, 2015 at 10:17 AM, Mitch Sundt <mitche...@gmail.com > wrote: > >> Please only ask a question on either opendatakit@ or >> opendatakit-developers@ and do not repeat your questions. >> >> This question is more appropriate for the opendatakit@ list. >> >> >> On Mon, Dec 14, 2015 at 7:22 AM, Andrew de Klerk <andrew....@gmail.com > wrote: >> >>> I have 2 forms - stock and movement >>> >>> stock details a stock request >>> movement details a list of items (1 - x) going in or out for that stock >>> request >>> >>> I have successfully listed the detail of the stock request using the >>> standard data command as extracted from the examples >>> >>> $('#FIELD_1').text(data.get('stock_id')); >>> $('#FIELD_2').text(data.get('reference')); >>> $('#FIELD_3').text(data.get('date')); >>> $('#FIELD_4').text(data.get('location_latitude')); >>> $('#FIELD_5').text(data.get('location_longitude')); >>> >>> I now need to display the list of movements from the table and am unsure >>> how to request the data. I am thinking something like this below..but would >>> like some guidance if possible before going on a trial and error process >>> >>> for (var i = 0; i < [data('movement'),'uniqueid'].getCount(); i++) { >>> >>> itemHeading.text(data('movement').getData(i, 'stock_id')); >>> } >>> >>> any help much appreciated >>> >>> thanks >>> andrew >>> >>> -- >>> 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 >> mitche...@gmail.com >> >> -- >> 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. >> > >

Correct -- those are the intended uses for the lists.

Thanks!

··· On Mon, Dec 14, 2015 at 11:36 AM, Andrew de Klerk wrote:

thank you. The duplicate post was clearly unintentional as the first post
did not appear automatically because I was not subscribed to the group.

so for clarification the opendatakit-developers@ is only for source code
development and the opendatakit@ is for user customisation, form designs
etc?

If I am still not able to continue following clarice's advice I will post
to opendatakit@

Andrew

On Monday, 14 December 2015 21:05:20 UTC+2, clarice larson wrote:

Please follow Mitch's suggestion in the future. As to the answer to your
question, your reasoning is close. You will actually want to use the query
function of the control object to query the contents of another table. A
good example to look at is the Tea Time in Benin demo app in the jan2015
branch of the app-designer repo. In particular, you will want to take a
look at the app/tables/Tea_houses/js/Tea_houses_detail.js. In this file,
you can see that the Tea_types and Tea_inventory tables are queried. The
control.query call returns a data object. To see the control and data
functions available to you take a look at
app/framework/tables/js/control.js
and app-designer/app/framework/tables/js/data.js in the app-designer repo.

Clarice

On Mon, Dec 14, 2015 at 10:17 AM, Mitch Sundt mitche...@gmail.com wrote:

Please only ask a question on either opendatakit@ or
opendatakit-developers@ and do not repeat your questions.

This question is more appropriate for the opendatakit@ list.

On Mon, Dec 14, 2015 at 7:22 AM, Andrew de Klerk andrew....@gmail.com wrote:

I have 2 forms - stock and movement

stock details a stock request
movement details a list of items (1 - x) going in or out for that
stock request

I have successfully listed the detail of the stock request using the
standard data command as extracted from the examples

$('#FIELD_1').text(data.get('stock_id'));
$('#FIELD_2').text(data.get('reference'));
$('#FIELD_3').text(data.get('date'));
$('#FIELD_4').text(data.get('location_latitude'));
$('#FIELD_5').text(data.get('location_longitude'));

I now need to display the list of movements from the table and am
unsure how to request the data. I am thinking something like this
below..but would like some guidance if possible before going on a trial and
error process

for (var i = 0; i < [data('movement'),'uniqueid'].getCount(); i++) {

    itemHeading.text(data('movement').getData(i, 'stock_id'));

}

any help much appreciated

thanks
andrew

--
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
mitche...@gmail.com

--
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