Help me ( calculation function)

Dear all,
I want to know that how to calculate in multiple question in
ODK. If anyone to knew ,could you help me please? This attack files is
calculated one function but it did not multiple calculation. So , Could you
help me for this problem.?
Thank a lot.

cost.xlsx (10.6 KB)

Hi there,

multiple selects store data as a separated list. If you select
keyboard, mouse, and notebook, it will be stored as "keyboard mouse
notebook".

So when you write: ${item_a}='keyboard', that will only work if you've
selected keyboard and nothing else. What you want is:
selected(${item_a}, 'keyboard').

In your calculations, instead of this:
if(${item_a}='keyboard',3500,0)
if(${item_a}='mouse',200,0)
if(${item_a}='notebook',6500,0)
if(${item_a}='tablet',4500,0)
if(${item_a}='phone',5500,0)

You should have this:
if(selected(${item_a},'keyboard'),3500,0)
if(selected(${item_a},'mouse'),200,0)
if(selected(${item_a},'notebook'),6500,0)
if(selected(${item_a},'tablet'),4500,0)
if(selected(${item_a},'phone'),5500,0)

Hope that helps,

Yaw

ยทยทยท On Tue, Jan 31, 2017 at 1:48 PM, wrote: > Dear all, > I want to know that how to calculate in multiple question in ODK. > If anyone to knew ,could you help me please? This attack files is > calculated one function but it did not multiple calculation. So , Could you > help me for this problem.? > Thank a lot. > > -- > -- > 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.
1 Like

Thank you very much Yaw.

ยทยทยท On Friday, February 3, 2017 at 12:48:22 PM UTC+6:30, Yaw Anokwa wrote: > > Hi there, > > multiple selects store data as a separated list. If you select > keyboard, mouse, and notebook, it will be stored as "keyboard mouse > notebook". > > So when you write: ${item_a}='keyboard', that will only work if you've > selected keyboard and nothing else. What you want is: > selected(${item_a}, 'keyboard'). > > In your calculations, instead of this: > if(${item_a}='keyboard',3500,0) > if(${item_a}='mouse',200,0) > if(${item_a}='notebook',6500,0) > if(${item_a}='tablet',4500,0) > if(${item_a}='phone',5500,0) > > You should have this: > if(selected(${item_a},'keyboard'),3500,0) > if(selected(${item_a},'mouse'),200,0) > if(selected(${item_a},'notebook'),6500,0) > if(selected(${item_a},'tablet'),4500,0) > if(selected(${item_a},'phone'),5500,0) > > Hope that helps, > > Yaw > > On Tue, Jan 31, 2017 at 1:48 PM, <kh...@mercycorps.org > wrote: > > Dear all, > > I want to know that how to calculate in multiple question in > ODK. > > If anyone to knew ,could you help me please? This attack files is > > calculated one function but it did not multiple calculation. So , Could > you > > help me for this problem.? > > Thank a lot. > > > > -- > > -- > > 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. >