Dynamic Label Values?

I'm not sure if this is possible but I would like to be able to set a label value based on the answer to a previous question. So if someone has selected Answer A on screen 1 I need the label to show label F on the next screen. If Answer B was selected on screen 1 then I would need to show say, label M on the next screen.

The labels wouldn't be the answers themselves but a lookup using a constraint. Is there a way to achieve this using XLSForm?

I did think of using a select one control and referring to that in my label, but realised I needed a way of selecting the value picked up in the lookup..

Thanks

Damien,

Not entirely sure what you are asking, but here goes...

You can store a value in a hidden/calculate prompt and make that value
change based on a previous answer.
name: dude_status
calculate: if(selected(${gender}, 'male'), 'Dude', 'Not a dude')

Then you can use that calculate prompt in a label of another prompt to
show the value.
name: print_dude_status
label: This person's dude status is ${dude_status}

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Thu, Nov 14, 2013 at 11:50 PM, DamianLindley@aol.com wrote:

I'm not sure if this is possible but I would like to be able to set a label value based on the answer to a previous question. So if someone has selected Answer A on screen 1 I need the label to show label F on the next screen. If Answer B was selected on screen 1 then I would need to show say, label M on the next screen.

The labels wouldn't be the answers themselves but a lookup using a constraint. Is there a way to achieve this using XLSForm?

I did think of using a select one control and referring to that in my label, but realised I needed a way of selecting the value picked up in the lookup..

Thanks

--

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.

thanks for that...

··· On Friday, 15 November 2013 07:50:37 UTC, damian...@aol.com wrote: > I'm not sure if this is possible but I would like to be able to set a label value based on the answer to a previous question. So if someone has selected Answer A on screen 1 I need the label to show label F on the next screen. If Answer B was selected on screen 1 then I would need to show say, label M on the next screen. > > The labels wouldn't be the answers themselves but a lookup using a constraint. Is there a way to achieve this using XLSForm? > > I did think of using a select one control and referring to that in my label, but realised I needed a way of selecting the value picked up in the lookup.. > > Thanks

Hi Damian,

Just be careful using calculations. They don't occur in sequential order
with the form. I'm sure there is a ruleset for when calculations happen,
but I don't know what it is and I haven't been able to figure it out. It
seems to be dependent on form size / number of other calculations, among
other things.

The bottom line is that the calculate could be run too early or too late to
capture the correct value. I had calculates doing a variety of things for
dynamic labels and had to take them out because they weren't reliable.
Sometimes they'd be fine, sometimes they wouldn't calculate before display
and they would leave a blank, or have an incorrect value. You can use an
if() with a default value to mitigate this to some extent, but it isn't
always sufficient.

Jason

··· On Sunday, November 17, 2013 11:01:12 PM UTC-5, Yaw Anokwa wrote: > > Damien, > > Not entirely sure what you are asking, but here goes... > > You can store a value in a hidden/calculate prompt and make that value > change based on a previous answer. > name: dude_status > calculate: if(selected(${gender}, 'male'), 'Dude', 'Not a dude') > > Then you can use that calculate prompt in a label of another prompt to > show the value. > name: print_dude_status > label: This person's dude status is ${dude_status} > > Yaw > -- > Need ODK services? http://nafundi.comprovides form design, server > setup, professional support, and software development for ODK. > > On Thu, Nov 14, 2013 at 11:50 PM, <Damian...@aol.com > wrote: > > I'm not sure if this is possible but I would like to be able to set a > label value based on the answer to a previous question. So if someone has > selected Answer A on screen 1 I need the label to show label F on the next > screen. If Answer B was selected on screen 1 then I would need to show > say, label M on the next screen. > > > > The labels wouldn't be the answers themselves but a lookup using a > constraint. Is there a way to achieve this using XLSForm? > > > > I did think of using a select one control and referring to that in my > label, but realised I needed a way of selecting the value picked up in the > lookup.. > > > > Thanks > > > > -- > > -- > > Post: opend...@googlegroups.com > > Unsubscribe: opendatakit...@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...@googlegroups.com . > > For more options, visit https://groups.google.com/groups/opt_out. >