If statement true, then apply particular integer

Hi there,
This is my first try at working with XLS forms. I've studied the
documentation, read many of the posts here, and haven't found the solution
I'm looking for. I have a particular field where if a previous answer
(question A) is no, then I'd like a zero applied to this field (question B)
without the field ever opening. I already have the relevant applied in
question B so it doesn't open unless the question A is yes. I'm unable to
default question B to a zero, as this is data collection, and a zero
implies something was actually counted.

Any help you can provide would be greatly appreciated!

Thanks!

Hi Michelle,

Welcome to ODK!

Before I answer your question, I should note that you are fighting the
form spec here. ODK only sends the answers that are relevant (e.g.,
the answers along the path you followed through the form) to the
server. So if qA is no, then you don't need to store anything in qB
because you know the user never saw that question. qB was never
relevant.

If you add a "default" column to your form and put 0 in the row with
question B, it'll store a 0 even if the user didn't see that question.
The caveat is that users will see 0 when question B is relevant.
Defaults are static, so whatever you put in that column is what shows
up regardless of your inputs. You cannot put something like if(${qA} =
'no', '0', '').

If you do want to store some dynamic value that is hidden, then you
can use the calculate question and store whatever you want in the
calculation column. Your user will never see this question but you can
store whatever you'd like in it.

Hope that helps,

Yaw

··· On Fri, Apr 7, 2017 at 12:19 PM, Michelle Reilly wrote: > Hi there, > This is my first try at working with XLS forms. I've studied the > documentation, read many of the posts here, and haven't found the solution > I'm looking for. I have a particular field where if a previous answer > (question A) is no, then I'd like a zero applied to this field (question B) > without the field ever opening. I already have the relevant applied in > question B so it doesn't open unless the question A is yes. I'm unable to > default question B to a zero, as this is data collection, and a zero implies > something was actually counted. > > Any help you can provide would be greatly appreciated! > > 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/d/optout.

Hello Yaw! Thank you for the welcome and the information.

The quandary is that we require every field to be filled out. The data
collection is for a bird species. They are asked in question A if they have
seen this particular bird. If no, then there's no need to count them, if
yes, then the fields would open to apply the amount they've seen (and other
descriptions). To ensure no fields have been skipped, we default all
integers to -98. This way, during the QA/QC process, we can determine
whether a field was forgotten or skipped. I'm unable to make them required
since they won't always be opened. We're using a different data collection
program right now that allows me to use actions to apply the zero if a
previous question has a selected a particular answer.

But I'm assuming this is something I'm unable to do with XLS forms.
Hopefully one day it can. :slight_smile:

Thank you again!

··· On Friday, April 7, 2017 at 3:23:14 PM UTC-7, Yaw Anokwa wrote: > > Hi Michelle, > > Welcome to ODK! > > Before I answer your question, I should note that you are fighting the > form spec here. ODK only sends the answers that are relevant (e.g., > the answers along the path you followed through the form) to the > server. So if qA is no, then you don't need to store anything in qB > because you know the user never saw that question. qB was never > relevant. > > If you add a "default" column to your form and put 0 in the row with > question B, it'll store a 0 even if the user didn't see that question. > The caveat is that users will see 0 when question B is relevant. > Defaults are static, so whatever you put in that column is what shows > up regardless of your inputs. You cannot put something like if(${qA} = > 'no', '0', ''). > > If you do want to store some dynamic value that is hidden, then you > can use the calculate question and store whatever you want in the > calculation column. Your user will never see this question but you can > store whatever you'd like in it. > > Hope that helps, > > Yaw > > On Fri, Apr 7, 2017 at 12:19 PM, Michelle Reilly <dij...@gmail.com > wrote: > > Hi there, > > This is my first try at working with XLS forms. I've studied the > > documentation, read many of the posts here, and haven't found the > solution > > I'm looking for. I have a particular field where if a previous answer > > (question A) is no, then I'd like a zero applied to this field (question > B) > > without the field ever opening. I already have the relevant applied in > > question B so it doesn't open unless the question A is yes. I'm unable > to > > default question B to a zero, as this is data collection, and a zero > implies > > something was actually counted. > > > > Any help you can provide would be greatly appreciated! > > > > 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/d/optout. >

Hi Michelle,

I think you can still use ODK for this.

You can default all integers to -98, you can make all questions
required, and you can use relevance to only ask questions for
particular birds. ODK only checks required questions that are
relevant, so if a user doesn't see Bird A, they won't get those
questions. But in the submission, you should still get -98 for Bird A
counts since you've set those defaults. Give it a try!

The thing that's not ideal is that the user has to delete -98 from the
integer questions they do see. But they can long-press that text box
to quickly clear the answer. And if the data doesn't have to be
terribly fine-grained, you could also switch to select-one with a
default of -98, and then a select-one list that groups the numbers
(e.g., 0,5,10, 20 or 0,1,2,3...10, 15, 20+).

Hope that helps,

Yaw

··· On Mon, Apr 10, 2017 at 7:06 AM, Michelle Reilly wrote: > Hello Yaw! Thank you for the welcome and the information. > > The quandary is that we require every field to be filled out. The data > collection is for a bird species. They are asked in question A if they have > seen this particular bird. If no, then there's no need to count them, if > yes, then the fields would open to apply the amount they've seen (and other > descriptions). To ensure no fields have been skipped, we default all > integers to -98. This way, during the QA/QC process, we can determine > whether a field was forgotten or skipped. I'm unable to make them required > since they won't always be opened. We're using a different data collection > program right now that allows me to use actions to apply the zero if a > previous question has a selected a particular answer. > > But I'm assuming this is something I'm unable to do with XLS forms. > Hopefully one day it can. :) > > Thank you again! > > On Friday, April 7, 2017 at 3:23:14 PM UTC-7, Yaw Anokwa wrote: >> >> Hi Michelle, >> >> Welcome to ODK! >> >> Before I answer your question, I should note that you are fighting the >> form spec here. ODK only sends the answers that are relevant (e.g., >> the answers along the path you followed through the form) to the >> server. So if qA is no, then you don't need to store anything in qB >> because you know the user never saw that question. qB was never >> relevant. >> >> If you add a "default" column to your form and put 0 in the row with >> question B, it'll store a 0 even if the user didn't see that question. >> The caveat is that users will see 0 when question B is relevant. >> Defaults are static, so whatever you put in that column is what shows >> up regardless of your inputs. You cannot put something like if(${qA} = >> 'no', '0', ''). >> >> If you do want to store some dynamic value that is hidden, then you >> can use the calculate question and store whatever you want in the >> calculation column. Your user will never see this question but you can >> store whatever you'd like in it. >> >> Hope that helps, >> >> Yaw >> >> On Fri, Apr 7, 2017 at 12:19 PM, Michelle Reilly wrote: >> > Hi there, >> > This is my first try at working with XLS forms. I've studied the >> > documentation, read many of the posts here, and haven't found the >> > solution >> > I'm looking for. I have a particular field where if a previous answer >> > (question A) is no, then I'd like a zero applied to this field (question >> > B) >> > without the field ever opening. I already have the relevant applied in >> > question B so it doesn't open unless the question A is yes. I'm unable >> > to >> > default question B to a zero, as this is data collection, and a zero >> > implies >> > something was actually counted. >> > >> > Any help you can provide would be greatly appreciated! >> > >> > 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/d/optout. > > -- > -- > 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/d/optout.