Fixtures filtering by value in form

Hi,

I have been experimenting with fixtures and have the example working.

In my use case I want to select a value from a large table by row then
field.

I have the row syntax i.e.
instance(‘districts’)/district_list/district[1]/name this gets me the row
by number and the field.

I would like to replace the number and the field with values generated in
the form. i.e. instance(‘districts’)/district_list/district[/data/rownumber
]//data/fieldname.

XPath isn’t my forte some any help much appreciated.

Thanks in advance

Tim

Hi Tim,

See the “Filtering the ItemSet” section here:
https://help.commcarehq.org/pages/viewpage.action?pageId=12222793

Cory

··· On Fri, Apr 4, 2014 at 11:06 AM, Tim wrote:

Hi,

I have been experimenting with fixtures and have the example working.

In my use case I want to select a value from a large table by row then
field.

I have the row syntax i.e.
instance(‘districts’)/district_list/district[1]/name this gets me the row
by number and the field.

I would like to replace the number and the field with values generated in
the form. i.e. instance(‘districts’)/district_list/district
[/data/rownumber]//data/fieldname.

XPath isn’t my forte some any help much appreciated.

Thanks in advance

Tim


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

Hi Cory,

Thanks for this.

Looking at the filter, that allows me to filter by value in a field. What I
am looking to do is to get a value from a row/field intersection, much like
vLookup in excel or the value from a place in an array i.e. array[2,2].

I am sure it’s not that hard just can’t get my head around it!

Best

Tim

··· On 6 Apr 2014 12:58, "Cory Zue" wrote:

Hi Tim,

See the “Filtering the ItemSet” section here:
https://help.commcarehq.org/pages/viewpage.action?pageId=12222793

Cory

On Fri, Apr 4, 2014 at 11:06 AM, Tim tim.butler.88@gmail.com wrote:

Hi,

I have been experimenting with fixtures and have the example working.

In my use case I want to select a value from a large table by row then
field.

I have the row syntax i.e.
instance(‘districts’)/district_list/district[1]/name this gets me the row
by number and the field.

I would like to replace the number and the field with values generated in
the form. i.e. instance(‘districts’)/district_list/district
[/data/rownumber]//data/fieldname.

XPath isn’t my forte some any help much appreciated.

Thanks in advance

Tim


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


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-users/fU0JpONA9vc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim,

If I’m understanding correctly you want to select a fixture entry based
both on its row number and a value in one of its fields. In that case,
you’ll want to use something like this

instance(‘districts’)/district_list/district[/data/rownumber]/data/[fieldname=value_from_form]/field_you_want

Please let me know if I’m misunderstanding you or this isn’t clear enough.

Best,
Will

··· On Sun, Apr 6, 2014 at 8:15 AM, Tim Butler wrote:

Hi Cory,

Thanks for this.

Looking at the filter, that allows me to filter by value in a field. What
I am looking to do is to get a value from a row/field intersection, much
like vLookup in excel or the value from a place in an array i.e. array[2,2].

I am sure it’s not that hard just can’t get my head around it!

Best

Tim
On 6 Apr 2014 12:58, “Cory Zue” czue@dimagi.com wrote:

Hi Tim,

See the “Filtering the ItemSet” section here:
https://help.commcarehq.org/pages/viewpage.action?pageId=12222793

Cory

On Fri, Apr 4, 2014 at 11:06 AM, Tim tim.butler.88@gmail.com wrote:

Hi,

I have been experimenting with fixtures and have the example working.

In my use case I want to select a value from a large table by row then
field.

I have the row syntax i.e.
instance(‘districts’)/district_list/district[1]/name this gets me the row
by number and the field.

I would like to replace the number and the field with values generated
in the form. i.e. instance(‘districts’)/district_list/district
[/data/rownumber]//data/fieldname.

XPath isn’t my forte some any help much appreciated.

Thanks in advance

Tim


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


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-users/fU0JpONA9vc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+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
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will,

My understanding of this says

instance(‘districts’)/district_list/district[/data/rownumber] gives me the
row,

the /data/[fieldname=value_from_form]/ gives me the column

and the last is the result field_you_want?

I will give this a go tomorrow.

Thanks for the help.

Best

Tim

··· On 6 Apr 2014 20:09, "William Pride" wrote:

Tim,

If I’m understanding correctly you want to select a fixture entry based
both on its row number and a value in one of its fields. In that case,
you’ll want to use something like this

instance(‘districts’)/district_list/district[/data/rownumber]/data/[fieldname=value_from_form]/field_you_want

Please let me know if I’m misunderstanding you or this isn’t clear enough.

Best,
Will

On Sun, Apr 6, 2014 at 8:15 AM, Tim Butler tim.butler.88@gmail.comwrote:

Hi Cory,

Thanks for this.

Looking at the filter, that allows me to filter by value in a field. What
I am looking to do is to get a value from a row/field intersection, much
like vLookup in excel or the value from a place in an array i.e. array[2,2].

I am sure it’s not that hard just can’t get my head around it!

Best

Tim
On 6 Apr 2014 12:58, “Cory Zue” czue@dimagi.com wrote:

Hi Tim,

See the “Filtering the ItemSet” section here:
https://help.commcarehq.org/pages/viewpage.action?pageId=12222793

Cory

On Fri, Apr 4, 2014 at 11:06 AM, Tim tim.butler.88@gmail.com wrote:

Hi,

I have been experimenting with fixtures and have the example working.

In my use case I want to select a value from a large table by row then
field.

I have the row syntax i.e.
instance(‘districts’)/district_list/district[1]/name this gets me the row
by number and the field.

I would like to replace the number and the field with values generated
in the form. i.e. instance(‘districts’)/district_list/district
[/data/rownumber]//data/fieldname.

XPath isn’t my forte some any help much appreciated.

Thanks in advance

Tim


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


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-users/fU0JpONA9vc/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to
commcare-users+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
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-users/fU0JpONA9vc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Will

I have now got to the following:

instance('districts')/district_list/district[number(/data/rownumber)]/name
with the number wrap I get the correct row! :slight_smile:

With this I get the desired result.

For the second half I am still confused.
The /data/[fieldname=value_from_form]/field_you_want part I cannot make to
work.

I understand that I am selecting a field by name what I don't understand is
the actual syntax. So if I had a single drop down name fieldname1 that had
name and state_id as options how do I put that in place of name in the
above?

Thanks for your patience.

Tim

··· On Sunday, 6 April 2014 21:35:21 UTC+1, Tim wrote: > > Hi Will, > > My understanding of this says > > instance('districts')/district_list/district[/data/rownumber] gives me the > row, > > the /data/[fieldname=value_from_form]/ gives me the column > > and the last is the result field_you_want? > > I will give this a go tomorrow. > > Thanks for the help. > > Best > > Tim > On 6 Apr 2014 20:09, "William Pride" wrote: > >> Tim, >> >> If I'm understanding correctly you want to select a fixture entry based >> both on its row number and a value in one of its fields. In that case, >> you'll want to use something like this >> >> >> instance('districts')/district_list/district[/data/rownumber]/data/[fieldname=value_from_form]/field_you_want >> >> Please let me know if I'm misunderstanding you or this isn't clear enough. >> >> Best, >> Will >> >

We've moved this discussion off users as it was getting very
domain-specific.

Best,
Will

··· On Mon, Apr 7, 2014 at 6:13 AM, Tim wrote:

Hi Will

I have now got to the following:

instance('districts')/district_list/district[number(/data/rownumber)]/name
with the number wrap I get the correct row! :slight_smile:

With this I get the desired result.

For the second half I am still confused. The /data/[fieldname=
value_from_form]/field_you_want part I cannot make to work.

I understand that I am selecting a field by name what I don't understand
is the actual syntax. So if I had a single drop down name fieldname1 that
had name and state_id as options how do I put that in place of name in the
above?

Thanks for your patience.

Tim

On Sunday, 6 April 2014 21:35:21 UTC+1, Tim wrote:

Hi Will,

My understanding of this says

instance('districts')/district_list/district[/data/rownumber] gives me
the row,

the /data/[fieldname=value_from_form]/ gives me the column

and the last is the result field_you_want?

I will give this a go tomorrow.

Thanks for the help.

Best

Tim
On 6 Apr 2014 20:09, "William Pride" wpride@dimagi.com wrote:

Tim,

If I'm understanding correctly you want to select a fixture entry based
both on its row number and a value in one of its fields. In that case,
you'll want to use something like this

instance('districts')/district_list/district[/data/
rownumber]/data/[fieldname=value_from_form]/field_you_want

Please let me know if I'm misunderstanding you or this isn't clear
enough.

Best,
Will

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