# Calculation Value

**URL:** <https://forum.dimagi.com/t/calculation-value/2865>\
**Category:** Users\
**Created:** [July 25, 2016, 1:39pm UTC](https://forum.dimagi.com/t/calculation-value/2865 "2016-07-25T13:39:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [July 25, 2016, 1:39pm UTC](https://forum.dimagi.com/t/calculation-value/2865/1 "2016-07-25T13:39:34Z")

</div>

Mahmoud,

caseid is definitely guaranteed to be globally unique (it is a uuid-v4  
compatible unique identifier), and you can use it to track models through  
the database.

You can access a caseid from the phone, but it can be a bit technical. You  
want to reference the ID inside of a form where you have selected a case  
first, correct?

-Clayton

> **···**
>
> On Sat, Jul 23, 2016 at 1:02 PM, Mahmoud Abo Shabo wrote:
> 
> > Now I see that\* info.caseid\* is long and could not be a unique case ID, I  
> > would give each case a unique ID to use it in the future.
> > 
> > On Saturday, July 23, 2016 at 10:35:26 AM UTC+3, Mahmoud Abo Shabo wrote:
> > 
> > > Hi dears,
> > > 
> > > I am trying to create a score system to calculate and give each value  
> > > selected number or score to have at the end total mark.
> > > 
> > > I attached an example to what I would to do.
> > > 
> > > The expression is  
> > > if(selected(${pizza\_toppings},'cheese'),total+2,total+0) or  
> > > if(selected(${pizza\_toppings},'pepperoni'),total+6,total+0) or  
> > > if(selected(${pizza\_toppings},'sausage'),total+6,total+0)
> > > 
> > > please see the attach file.
> > > 
> > > Also, I would to see \*info.caseid \*at the phone. Is there any way to see  
> > > this number during the data collection?
> > > 
> > > Regards
> > > 
> > > --  
> > > 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](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mahmoud\_Abo\_Shabo](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/m/dfb087/32.png) [@Mahmoud\_Abo\_Shabo](https://forum.dimagi.com/u/Mahmoud_Abo_Shabo)\
**Post date:** [July 25, 2016, 2:35pm UTC](https://forum.dimagi.com/t/calculation-value/2865/2 "2016-07-25T14:35:00Z")

</div>

Thanks Clayton,  
What I mean by "It can be a unique ID" because it too long and I could not  
use it as an ID that the user can remember it.  
I am looking to have a unique number consists of 5 digits as a max value.  
Any by the end of the assessment, the emulator give the interviewee his/her  
number.

Regards

> **···**
>
> On Monday, July 25, 2016 at 4:39:55 PM UTC+3, Clayton Sims wrote: \> \> Mahmoud, \> \> caseid is definitely guaranteed to be globally unique (it is a uuid-v4 \> compatible unique identifier), and you can use it to track models through \> the database. \> \> You can access a caseid from the phone, but it can be a bit technical. You \> want to reference the ID inside of a form where you have selected a case \> first, correct? \> \> -Clayton \> \> On Sat, Jul 23, 2016 at 1:02 PM, Mahmoud Abo Shabo wrote: \> \>\> Now I see that\* info.caseid\* is long and could not be a unique case ID, \>\> I would give each case a unique ID to use it in the future. \>\> \>\> \>\> On Saturday, July 23, 2016 at 10:35:26 AM UTC+3, Mahmoud Abo Shabo wrote: \>\>\> \>\>\> Hi dears, \>\>\> \>\>\> I am trying to create a score system to calculate and give each value \>\>\> selected number or score to have at the end total mark. \>\>\> \>\>\> I attached an example to what I would to do. \>\>\> \>\>\> The expression is \>\>\> if(selected(${pizza\_toppings},'cheese'),total+2,total+0) or \>\>\> if(selected(${pizza\_toppings},'pepperoni'),total+6,total+0) or \>\>\> if(selected(${pizza\_toppings},'sausage'),total+6,total+0) \>\>\> \>\>\> please see the attach file. \>\>\> \>\>\> Also, I would to see \*info.caseid \*at the phone. Is there any way to \>\>\> see this number during the data collection? \>\>\> \>\>\> Regards \>\>\> \>\>\> -- \>\> 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/d/optout. \>\> \> \>

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [July 25, 2016, 2:58pm UTC](https://forum.dimagi.com/t/calculation-value/2865/3 "2016-07-25T14:58:28Z")

</div>

Ah, I understand now, thanks for clarifying.

If your project is on a Standard Plan with CommCare one helpful mechanism  
for this is to set up a "User Case" for the project, which allows each user  
to keep their own data across forms.

[https://confluence.dimagi.com/display/commcarepublic/User+Case](https://confluence.dimagi.com/display/commcarepublic/User+Case)

You can then set up a question in the form, for instance, where you either  
give an increasing count (1-99,999) or you can attach an  
enumerator-specific ID and prepend that to the count to provide an ID which  
is unique between enumerators, like

U2-30423

-Clayton

> **···**
>
> On Mon, Jul 25, 2016 at 10:35 AM, Mahmoud Abo Shabo wrote:
> 
> > Thanks Clayton,  
> > What I mean by "It can be a unique ID" because it too long and I could not  
> > use it as an ID that the user can remember it.  
> > I am looking to have a unique number consists of 5 digits as a max value.  
> > Any by the end of the assessment, the emulator give the interviewee his/her  
> > number.
> > 
> > Regards
> > 
> > On Monday, July 25, 2016 at 4:39:55 PM UTC+3, Clayton Sims wrote:
> > 
> > > Mahmoud,
> > > 
> > > caseid is definitely guaranteed to be globally unique (it is a uuid-v4  
> > > compatible unique identifier), and you can use it to track models through  
> > > the database.
> > > 
> > > You can access a caseid from the phone, but it can be a bit technical.  
> > > You want to reference the ID inside of a form where you have selected a  
> > > case first, correct?
> > > 
> > > -Clayton
> > > 
> > > On Sat, Jul 23, 2016 at 1:02 PM, Mahmoud Abo Shabo [almu...@gmail.com](mailto:almu...@gmail.com) wrote:
> > > 
> > > > Now I see that\* info.caseid\* is long and could not be a unique case ID,  
> > > > I would give each case a unique ID to use it in the future.
> > > > 
> > > > On Saturday, July 23, 2016 at 10:35:26 AM UTC+3, Mahmoud Abo Shabo wrote:
> > > > 
> > > > > Hi dears,
> > > > > 
> > > > > I am trying to create a score system to calculate and give each value  
> > > > > selected number or score to have at the end total mark.
> > > > > 
> > > > > I attached an example to what I would to do.
> > > > > 
> > > > > The expression is  
> > > > > if(selected(${pizza\_toppings},'cheese'),total+2,total+0) or  
> > > > > if(selected(${pizza\_toppings},'pepperoni'),total+6,total+0) or  
> > > > > if(selected(${pizza\_toppings},'sausage'),total+6,total+0)
> > > > > 
> > > > > please see the attach file.
> > > > > 
> > > > > Also, I would to see \*info.caseid \*at the phone. Is there any way to  
> > > > > see this number during the data collection?
> > > > > 
> > > > > Regards
> > > > > 
> > > > > --  
> > > > > 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](mailto:commcare-user...@googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/d/optout](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](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![czue](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/czue/32/493_2.png) [@czue](https://forum.dimagi.com/u/czue)\
**Post date:** [July 25, 2016, 3:01pm UTC](https://forum.dimagi.com/t/calculation-value/2865/4 "2016-07-25T15:01:01Z")

</div>

Hey Mahmoud,

The best way to do that would be to use the User Case feature  
[https://confluence.dimagi.com/display/commcarepublic/User+Case](https://confluence.dimagi.com/display/commcarepublic/User+Case) to keep a  
count on the device which you can use as an incrementing ID number. There  
are some caveats to this approach which are listed on that page.

thanks,  
Cory

> **···**
>
> On Mon, Jul 25, 2016 at 4:35 PM, Mahmoud Abo Shabo wrote:
> 
> > Thanks Clayton,  
> > What I mean by "It can be a unique ID" because it too long and I could not  
> > use it as an ID that the user can remember it.  
> > I am looking to have a unique number consists of 5 digits as a max value.  
> > Any by the end of the assessment, the emulator give the interviewee his/her  
> > number.
> > 
> > Regards
> > 
> > On Monday, July 25, 2016 at 4:39:55 PM UTC+3, Clayton Sims wrote:
> > 
> > > Mahmoud,
> > > 
> > > caseid is definitely guaranteed to be globally unique (it is a uuid-v4  
> > > compatible unique identifier), and you can use it to track models through  
> > > the database.
> > > 
> > > You can access a caseid from the phone, but it can be a bit technical.  
> > > You want to reference the ID inside of a form where you have selected a  
> > > case first, correct?
> > > 
> > > -Clayton
> > > 
> > > On Sat, Jul 23, 2016 at 1:02 PM, Mahmoud Abo Shabo [almu...@gmail.com](mailto:almu...@gmail.com) wrote:
> > > 
> > > > Now I see that\* info.caseid\* is long and could not be a unique case ID,  
> > > > I would give each case a unique ID to use it in the future.
> > > > 
> > > > On Saturday, July 23, 2016 at 10:35:26 AM UTC+3, Mahmoud Abo Shabo wrote:
> > > > 
> > > > > Hi dears,
> > > > > 
> > > > > I am trying to create a score system to calculate and give each value  
> > > > > selected number or score to have at the end total mark.
> > > > > 
> > > > > I attached an example to what I would to do.
> > > > > 
> > > > > The expression is  
> > > > > if(selected(${pizza\_toppings},'cheese'),total+2,total+0) or  
> > > > > if(selected(${pizza\_toppings},'pepperoni'),total+6,total+0) or  
> > > > > if(selected(${pizza\_toppings},'sausage'),total+6,total+0)
> > > > > 
> > > > > please see the attach file.
> > > > > 
> > > > > Also, I would to see \*info.caseid \*at the phone. Is there any way to  
> > > > > see this number during the data collection?
> > > > > 
> > > > > Regards
> > > > > 
> > > > > --  
> > > > > 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](mailto:commcare-user...@googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/d/optout](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](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
