Generating sequential numbers for form instances

I have a partial solution to this problem, but I’m wondering if anyone has
a better idea…

We are doing a house to house census. Detailed information is recorded in a
paper register for each household in a locality, to be kept by a local key
informant. Summary information for each household is recorded in a CommCare
form by a fieldworker. The households do not have numbers, but we would
like to allocate “human-friendly” numbers to the households to be recorded
in the paper register. Each locality has an ID number (a barcode on the
front of the paper register). The whole of each locality is enumerated by
one fieldworker in conjunction with the local key informant. We’ve made an
application in which localities are cases. Our census form is a household
record, and the form increments a number stored in the case that it then
displays to the user as the household number.

This works, except if a fieldworker stores a partial record, and then goes
on to the next household. Because the case data was never updated for the
previous household, the next household will get the same household number.
We can get round this by using CommCare Sense, which prevents users storing
partial records.

Does anyone have a better suggestion, preferably one that would allow the
fieldworkers to store partial records?

One thought I’ve had is that if a form could know how many partial
instances of the form have been saved on the phone, we could get around
this problem. But I’m not aware of any way of the form knowing that.

Thanks.

James,

You are saying that there is a case representing the locality, and that
each time someone fills out a creation form, the locality "household count"
increases by one?

If that is the case, it should actually be possible to set up your form
such that even when someone saves and restores and incomplete form, the
"Household Number" increases by one. Currently we load the value in a
specific way that doesn’t get re-triggered on incomplete forms, but you
could instead set it up to fire each time the form is loaded.

Is the way your locality data is configured set up using a parent/subcase
relationship on HQ?

-Clayton

··· On Wed, Aug 21, 2013 at 3:07 PM, james beard wrote:

I have a partial solution to this problem, but I’m wondering if anyone has
a better idea…

We are doing a house to house census. Detailed information is recorded in
a paper register for each household in a locality, to be kept by a local
key informant. Summary information for each household is recorded in a
CommCare form by a fieldworker. The households do not have numbers, but we
would like to allocate “human-friendly” numbers to the households to be
recorded in the paper register. Each locality has an ID number (a barcode
on the front of the paper register). The whole of each locality is
enumerated by one fieldworker in conjunction with the local key informant.
We’ve made an application in which localities are cases. Our census form is
a household record, and the form increments a number stored in the case
that it then displays to the user as the household number.

This works, except if a fieldworker stores a partial record, and then goes
on to the next household. Because the case data was never updated for the
previous household, the next household will get the same household number.
We can get round this by using CommCare Sense, which prevents users storing
partial records.

Does anyone have a better suggestion, preferably one that would allow the
fieldworkers to store partial records?

One thought I’ve had is that if a form could know how many partial
instances of the form have been saved on the phone, we could get around
this problem. But I’m not aware of any way of the form knowing that.

Thanks.


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/groups/opt_out.

Hi There,

I am facing the same issue. I have counts that are based on the number of
times an individual user completes a form and the location. So eligibility
for the follow up form is every 14th household in one location and every
16th household in another location. The counts work fine except if a form
is saved as incomplete. Then the sequence is out. Would the expression
described below also be suitable for my project?

instance(‘casedb’)/casedb/case[@case_id=instance(‘commcaresession’)/session/
data/case_id]/YOURPROPERTY

Cheers,
Jess

··· On Thursday, August 22, 2013 at 5:07:20 AM UTC+10, james beard wrote: > > I have a partial solution to this problem, but I'm wondering if anyone has > a better idea... > > We are doing a house to house census. Detailed information is recorded in > a paper register for each household in a locality, to be kept by a local > key informant. Summary information for each household is recorded in a > CommCare form by a fieldworker. The households do not have numbers, but we > would like to allocate "human-friendly" numbers to the households to be > recorded in the paper register. Each locality has an ID number (a barcode > on the front of the paper register). The whole of each locality is > enumerated by one fieldworker in conjunction with the local key informant. > We've made an application in which localities are cases. Our census form is > a household record, and the form increments a number stored in the case > that it then displays to the user as the household number. > > This works, except if a fieldworker stores a partial record, and then goes > on to the next household. Because the case data was never updated for the > previous household, the next household will get the same household number. > We can get round this by using CommCare Sense, which prevents users storing > partial records. > > Does anyone have a better suggestion, preferably one that would allow the > fieldworkers to store partial records? > > One thought I've had is that if a form could know how many partial > instances of the form have been saved on the phone, we could get around > this problem. But I'm not aware of any way of the form knowing that. > > Thanks. > > >

Nearly. In this particular application, we are only using “locality” cases

  • the households aren’t themselves getting cases created for them.

Thanks.

··· On Thursday, August 22, 2013 2:35:23 PM UTC, Clayton Sims wrote: > > James, > > You are saying that there is a case representing the locality, and that > each time someone fills out a creation form, the locality "household count" > increases by one? > > If that is the case, it should actually be possible to set up your form > such that even when someone saves and restores and incomplete form, the > "Household Number" increases by one. Currently we load the value in a > specific way that doesn't get re-triggered on incomplete forms, but you > could instead set it up to fire each time the form is loaded. > > Is the way your locality data is configured set up using a parent/subcase > relationship on HQ? > > -Clayton > > > On Wed, Aug 21, 2013 at 3:07 PM, james beard <james.b...@gmail.com wrote: > >> I have a partial solution to this problem, but I'm wondering if anyone >> has a better idea... >> >> We are doing a house to house census. Detailed information is recorded in >> a paper register for each household in a locality, to be kept by a local >> key informant. Summary information for each household is recorded in a >> CommCare form by a fieldworker. The households do not have numbers, but we >> would like to allocate "human-friendly" numbers to the households to be >> recorded in the paper register. Each locality has an ID number (a barcode >> on the front of the paper register). The whole of each locality is >> enumerated by one fieldworker in conjunction with the local key informant. >> We've made an application in which localities are cases. Our census form is >> a household record, and the form increments a number stored in the case >> that it then displays to the user as the household number. >> >> This works, except if a fieldworker stores a partial record, and then >> goes on to the next household. Because the case data was never updated for >> the previous household, the next household will get the same household >> number. We can get round this by using CommCare Sense, which prevents users >> storing partial records. >> >> Does anyone have a better suggestion, preferably one that would allow the >> fieldworkers to store partial records? >> >> One thought I've had is that if a form could know how many partial >> instances of the form have been saved on the phone, we could get around >> this problem. But I'm not aware of any way of the form knowing that. >> >> Thanks. >> >> >> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/groups/opt_out. >> > >

Hi Jessica!

Incomplete forms won’t work for this workflow, unfortunately. Incomplete
forms don’t make any changes to case data on the phone until they are
finished at a later date.

If you need to allow users to only partially fill out a form while also
saving the case, the workaround is to save the case with a flag that notes
that not all required data has been collected and then requiring the user
to fill out another form supplying the required data before they can "use"
the case with other forms that require full enrollment.

-Clayton

··· On Mon, Jan 23, 2017 at 5:55 PM, Jessica Hall wrote:

Hi There,

I am facing the same issue. I have counts that are based on the number of
times an individual user completes a form and the location. So eligibility
for the follow up form is every 14th household in one location and every
16th household in another location. The counts work fine except if a form
is saved as incomplete. Then the sequence is out. Would the expression
described below also be suitable for my project?

instance(‘casedb’)/casedb/case[@case_id=instance(‘commcarese
ssion’)/session/data/case_id]/YOURPROPERTY

Cheers,
Jess

On Thursday, August 22, 2013 at 5:07:20 AM UTC+10, james beard wrote:

I have a partial solution to this problem, but I’m wondering if anyone
has a better idea…

We are doing a house to house census. Detailed information is recorded in
a paper register for each household in a locality, to be kept by a local
key informant. Summary information for each household is recorded in a
CommCare form by a fieldworker. The households do not have numbers, but we
would like to allocate “human-friendly” numbers to the households to be
recorded in the paper register. Each locality has an ID number (a barcode
on the front of the paper register). The whole of each locality is
enumerated by one fieldworker in conjunction with the local key informant.
We’ve made an application in which localities are cases. Our census form is
a household record, and the form increments a number stored in the case
that it then displays to the user as the household number.

This works, except if a fieldworker stores a partial record, and then
goes on to the next household. Because the case data was never updated for
the previous household, the next household will get the same household
number. We can get round this by using CommCare Sense, which prevents users
storing partial records.

Does anyone have a better suggestion, preferably one that would allow the
fieldworkers to store partial records?

One thought I’ve had is that if a form could know how many partial
instances of the form have been saved on the phone, we could get around
this problem. But I’m not aware of any way of the form knowing that.

Thanks.


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.

Ah, so the locality itself has the household count, and the form is filled
out after choosing it?

You should be able to address this by not loading the value that holds
the “current” household number using the CommCare HQ case configuration
section. Instead, inside of the Hidden Value in your form, set the
calculated value to be this expression

instance(‘casedb’)/casedb/case[@case_id=instance(‘commcaresession’)/session/data/case_id]/
YOURPROPERTY

··· * * where *YOURPROPERTY *is the name you use to save/load the property to the case.

You can save the value back to the case with the same method you’re using
now.

This will cause the value to always be calculated against the "current"
value of the household id in the locality, even if you’re loading the form
from incomplete.

-Clayton

On Fri, Aug 23, 2013 at 9:00 AM, james beard james.beard.tz@gmail.comwrote:

Nearly. In this particular application, we are only using “locality” cases

  • the households aren’t themselves getting cases created for them.

Thanks.

On Thursday, August 22, 2013 2:35:23 PM UTC, Clayton Sims wrote:

James,

You are saying that there is a case representing the locality, and that
each time someone fills out a creation form, the locality "household count"
increases by one?

If that is the case, it should actually be possible to set up your form
such that even when someone saves and restores and incomplete form, the
"Household Number" increases by one. Currently we load the value in a
specific way that doesn’t get re-triggered on incomplete forms, but you
could instead set it up to fire each time the form is loaded.

Is the way your locality data is configured set up using a parent/subcase
relationship on HQ?

-Clayton

On Wed, Aug 21, 2013 at 3:07 PM, james beard james.b...@gmail.comwrote:

I have a partial solution to this problem, but I’m wondering if anyone
has a better idea…

We are doing a house to house census. Detailed information is recorded
in a paper register for each household in a locality, to be kept by a local
key informant. Summary information for each household is recorded in a
CommCare form by a fieldworker. The households do not have numbers, but we
would like to allocate “human-friendly” numbers to the households to be
recorded in the paper register. Each locality has an ID number (a barcode
on the front of the paper register). The whole of each locality is
enumerated by one fieldworker in conjunction with the local key informant.
We’ve made an application in which localities are cases. Our census form is
a household record, and the form increments a number stored in the case
that it then displays to the user as the household number.

This works, except if a fieldworker stores a partial record, and then
goes on to the next household. Because the case data was never updated for
the previous household, the next household will get the same household
number. We can get round this by using CommCare Sense, which prevents users
storing partial records.

Does anyone have a better suggestion, preferably one that would allow
the fieldworkers to store partial records?

One thought I’ve had is that if a form could know how many partial
instances of the form have been saved on the phone, we could get around
this problem. But I’m not aware of any way of the form knowing that.

Thanks.


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-user…@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.


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/groups/opt_out.

Thanks, that’s a useful tip.

But actually, I mis-remembered how our form works when I wrote my last
post, and I think we may be able to address our problem a different way. I
will investigate and post again…

··· On Friday, August 23, 2013 6:27:40 PM UTC, Clayton Sims wrote: > > Ah, so the locality itself has the household count, and the form is filled > out after choosing it? > > You should be able to address this by _not_ loading the value that holds > the "current" household number using the CommCare HQ case configuration > section. Instead, inside of the Hidden Value in your form, set the > calculated value to be this expression > > > instance('casedb')/casedb/case[@case_id=instance('commcaresession')/session/data/case_id]/ > *YOURPROPERTY* > * > * > where *YOURPROPERTY *is the name you use to save/load the property to the > case. > > You can save the value back to the case with the same method you're using > now. > > This will cause the value to always be calculated against the "current" > value of the household id in the locality, even if you're loading the form > from incomplete. > > -Clayton > > > On Fri, Aug 23, 2013 at 9:00 AM, james beard <james.b...@gmail.com wrote: > >> Nearly. In this particular application, we are only using "locality" >> cases - the households aren't themselves getting cases created for them. >> >> Thanks. >> >> >> On Thursday, August 22, 2013 2:35:23 PM UTC, Clayton Sims wrote: >> >>> James, >>> >>> You are saying that there is a case representing the locality, and that >>> each time someone fills out a creation form, the locality "household count" >>> increases by one? >>> >>> If that is the case, it should actually be possible to set up your form >>> such that even when someone saves and restores and incomplete form, the >>> "Household Number" increases by one. Currently we load the value in a >>> specific way that doesn't get re-triggered on incomplete forms, but you >>> could instead set it up to fire each time the form is loaded. >>> >>> Is the way your locality data is configured set up using a >>> parent/subcase relationship on HQ? >>> >>> -Clayton >>> >>> >>> On Wed, Aug 21, 2013 at 3:07 PM, james beard wrote: >>> >>>> I have a partial solution to this problem, but I'm wondering if anyone >>>> has a better idea... >>>> >>>> We are doing a house to house census. Detailed information is recorded >>>> in a paper register for each household in a locality, to be kept by a local >>>> key informant. Summary information for each household is recorded in a >>>> CommCare form by a fieldworker. The households do not have numbers, but we >>>> would like to allocate "human-friendly" numbers to the households to be >>>> recorded in the paper register. Each locality has an ID number (a barcode >>>> on the front of the paper register). The whole of each locality is >>>> enumerated by one fieldworker in conjunction with the local key informant. >>>> We've made an application in which localities are cases. Our census form is >>>> a household record, and the form increments a number stored in the case >>>> that it then displays to the user as the household number. >>>> >>>> This works, except if a fieldworker stores a partial record, and then >>>> goes on to the next household. Because the case data was never updated for >>>> the previous household, the next household will get the same household >>>> number. We can get round this by using CommCare Sense, which prevents users >>>> storing partial records. >>>> >>>> Does anyone have a better suggestion, preferably one that would allow >>>> the fieldworkers to store partial records? >>>> >>>> One thought I've had is that if a form could know how many partial >>>> instances of the form have been saved on the phone, we could get around >>>> this problem. But I'm not aware of any way of the form knowing that. >>>> >>>> Thanks. >>>> >>>> >>>> -- >>>> 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-user...@**googlegroups.com. >>>> >>>> For more options, visit https://groups.google.com/**groups/opt_out >>>> . >>>> >>> >>> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/groups/opt_out. >> > >