We need help

we are developing Household survey apps.we have created repeat group that
registers all people leaving with in the household head including their
age and sex. From this we need to store all woman with age range 15 and
59,all men with age range 15 and 49 and all children under 5 in hidden
value from the repeat group automatically without asking the household
head again.

To do this we have created hidden values and set the calculate condition
as shown below

prev_men_aged_15_and_59 = coalesce(/data/men_aged_15_and_59, 0)

prev_woman_aged_15_and_59 = coalesce(/data/woman_aged_15_and_59, 0)

men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name = "male"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59+1, /data/prev_men_aged_15_and_59) .This will
store for the choice value male selected and age range between 15 and 59
entered.

woman_aged_15_and_59 = if(/data/Register_peoples_live/sex_name = "female"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_woman_aged_15_and_59+1, /data/prev_woman_aged_15_and_59) .The
same which store number of woman

children_under_5 = if( /data/Register_peoples_live/age_name <=
5,/data/number_of_peaples_staying,’ ').For storing children under 5 age
entered.

Unfortunately this is not working. Could somebody help me how to fix this
.The way we thought it would work is not working.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

Hello,

Could you describe what behavior you’re seeing when you say its not working?

When debugging calculates like this its often useful to break up the
constituent parts of the calculate and put them in a label IE:

/data/Register_peoples_live/sex_name = “male”
/data/Register_peoples_live/age_name >=15
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59

Could all be displayed in a label so that you can identify what parts
aren’t behaving as expected.

Unfortunately I think there might be some other issues with your
construction - for example, if someone were to swipe backwards to return to
a previous person, that calculate would fire again and potentially double
count that person.

One alternative design pattern might be to have some hidden variable that
takes the value 1 if the person meets the criteria and zero otherwise, IE
for men:

/data/meets_criteria = if(/data/Register_peoples_live/sex_name = “male” and
/data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name
<=59 , 1, 0)

Then, you could call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum
across
these nodes and derive your desired value. A similar pattern could be used
for the child count.

Best,
Will

··· On Sat, May 16, 2015 at 12:20 AM, Tewelde Aregawi wrote:

we are developing Household survey apps.we have created repeat group
that registers all people leaving with in the household head including
their age and sex. From this we need to store all woman with age range 15
and 59,all men with age range 15 and 49 and all children under 5 in hidden
value from the repeat group automatically without asking the household
head again.

To do this we have created hidden values and set the calculate condition
as shown below

prev_men_aged_15_and_59 = coalesce(/data/men_aged_15_and_59, 0)

prev_woman_aged_15_and_59 = coalesce(/data/woman_aged_15_and_59, 0)

men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59+1, /data/prev_men_aged_15_and_59) .This will
store for the choice value male selected and age range between 15 and 59
entered.

woman_aged_15_and_59 = if(/data/Register_peoples_live/sex_name = "female"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_woman_aged_15_and_59+1, /data/prev_woman_aged_15_and_59) .The
same which store number of woman

children_under_5 = if( /data/Register_peoples_live/age_name <=
5,/data/number_of_peaples_staying,’ ').For storing children under 5 age
entered.

Unfortunately this is not working. Could somebody help me how to fix this
.The way we thought it would work is not working.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype


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.

Dear william

Thanks for the quick response

Actually this was the error i am seeing

Errors making a new version:

  • Validation Error: Dependency cycles amongst the xpath expressions in
    relevant/calculate

More information:
Markup: 1 Unrecognized attributes found in Element [upload] and will be
ignored: [mediatype]
Markup: 1 Unrecognized attributes found in Element [upload] and will be
ignored: [ref]
Error: XPath Dependency Cycle:
/data/Register_peoples_live/sex_name => /data/men_aged_15_and_59
/data/Register_peoples_live/sex_name => /data/woman_aged_15_and_59
/data/men_aged_15_and_59 => /data/prev_men_aged_15_and_59
/data/prev_men_aged_15_and_59 => /data/men_aged_15_and_59
/data/woman_aged_15_and_59 => /data/prev_woman_aged_15_and_59
/data/Register_peoples_live/age_name => /data/men_aged_15_and_59
/data/Register_peoples_live/age_name => /data/woman_aged_15_and_59
/data/prev_woman_aged_15_and_59 => /data/woman_aged_15_and_59
in form

could you please explain more when you say call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum
across
these nodes and derive your desired value.It would be best if you can show
me one example.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

··· On Fri, May 15, 2015 at 9:39 PM, William Pride wrote:

Hello,

Could you describe what behavior you’re seeing when you say its not
working?

When debugging calculates like this its often useful to break up the
constituent parts of the calculate and put them in a label IE:

/data/Register_peoples_live/sex_name = “male”
/data/Register_peoples_live/age_name >=15
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59

Could all be displayed in a label so that you can identify what parts
aren’t behaving as expected.

Unfortunately I think there might be some other issues with your
construction - for example, if someone were to swipe backwards to return to
a previous person, that calculate would fire again and potentially double
count that person.

One alternative design pattern might be to have some hidden variable that
takes the value 1 if the person meets the criteria and zero otherwise, IE
for men:

/data/meets_criteria = if(/data/Register_peoples_live/sex_name = "male"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 , 1, 0)

Then, you could call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum across
these nodes and derive your desired value. A similar pattern could be used
for the child count.

Best,
Will

On Sat, May 16, 2015 at 12:20 AM, Tewelde Aregawi <teweldino.mvp@gmail.com wrote:

we are developing Household survey apps.we have created repeat group
that registers all people leaving with in the household head including
their age and sex. From this we need to store all woman with age range 15
and 59,all men with age range 15 and 49 and all children under 5 in hidden
value from the repeat group automatically without asking the household
head again.

To do this we have created hidden values and set the calculate
condition as shown below

prev_men_aged_15_and_59 = coalesce(/data/men_aged_15_and_59, 0)

prev_woman_aged_15_and_59 = coalesce(/data/woman_aged_15_and_59, 0)

men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59+1, /data/prev_men_aged_15_and_59) .This will
store for the choice value male selected and age range between 15 and 59
entered.

woman_aged_15_and_59 = if(/data/Register_peoples_live/sex_name = "female"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_woman_aged_15_and_59+1, /data/prev_woman_aged_15_and_59) .The
same which store number of woman

children_under_5 = if( /data/Register_peoples_live/age_name <=
5,/data/number_of_peaples_staying,’ ').For storing children under 5 age
entered.

Unfortunately this is not working. Could somebody help me how to fix this
.The way we thought it would work is not working.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype


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.


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.

Hello

I tried like you suggested me and the result is 0 and 1.The current value
is overwriting the previous value

prev_men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 , 1, 0)

men_aged_15_and_59 = sum(/data/prev_men_aged_15_and_59)

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

··· On Sat, May 16, 2015 at 9:05 AM, Tewelde Aregawi wrote:

Dear william

Thanks for the quick response

Actually this was the error i am seeing

Errors making a new version:

  • Validation Error: Dependency cycles amongst the xpath expressions
    in relevant/calculate

More information:
Markup: 1 Unrecognized attributes found in Element [upload] and will
be ignored: [mediatype]
Markup: 1 Unrecognized attributes found in Element [upload] and will
be ignored: [ref]
Error: XPath Dependency Cycle:
/data/Register_peoples_live/sex_name => /data/men_aged_15_and_59
/data/Register_peoples_live/sex_name => /data/woman_aged_15_and_59
/data/men_aged_15_and_59 => /data/prev_men_aged_15_and_59
/data/prev_men_aged_15_and_59 => /data/men_aged_15_and_59
/data/woman_aged_15_and_59 => /data/prev_woman_aged_15_and_59
/data/Register_peoples_live/age_name => /data/men_aged_15_and_59
/data/Register_peoples_live/age_name => /data/woman_aged_15_and_59
/data/prev_woman_aged_15_and_59 => /data/woman_aged_15_and_59
in form

could you please explain more when you say call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum across
these nodes and derive your desired value.It would be best if you can show
me one example.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

On Fri, May 15, 2015 at 9:39 PM, William Pride wpride@dimagi.com wrote:

Hello,

Could you describe what behavior you’re seeing when you say its not
working?

When debugging calculates like this its often useful to break up the
constituent parts of the calculate and put them in a label IE:

/data/Register_peoples_live/sex_name = “male”
/data/Register_peoples_live/age_name >=15
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59

Could all be displayed in a label so that you can identify what parts
aren’t behaving as expected.

Unfortunately I think there might be some other issues with your
construction - for example, if someone were to swipe backwards to return to
a previous person, that calculate would fire again and potentially double
count that person.

One alternative design pattern might be to have some hidden variable that
takes the value 1 if the person meets the criteria and zero otherwise, IE
for men:

/data/meets_criteria = if(/data/Register_peoples_live/sex_name = "male"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 , 1, 0)

Then, you could call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum across
these nodes and derive your desired value. A similar pattern could be used
for the child count.

Best,
Will

On Sat, May 16, 2015 at 12:20 AM, Tewelde Aregawi < teweldino.mvp@gmail.com> wrote:

we are developing Household survey apps.we have created repeat group
that registers all people leaving with in the household head including
their age and sex. From this we need to store all woman with age range 15
and 59,all men with age range 15 and 49 and all children under 5 in hidden
value from the repeat group automatically without asking the household
head again.

To do this we have created hidden values and set the calculate
condition as shown below

prev_men_aged_15_and_59 = coalesce(/data/men_aged_15_and_59, 0)

prev_woman_aged_15_and_59 = coalesce(/data/woman_aged_15_and_59, 0)

men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59+1, /data/prev_men_aged_15_and_59) .This will
store for the choice value male selected and age range between 15 and 59
entered.

woman_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“female” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_woman_aged_15_and_59+1, /data/prev_woman_aged_15_and_59) .The
same which store number of woman

children_under_5 = if( /data/Register_peoples_live/age_name <=
5,/data/number_of_peaples_staying,’ ').For storing children under 5 age
entered.

Unfortunately this is not working. Could somebody help me how to fix
this .The way we thought it would work is not working.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype


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.


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.

Hello,

You’ll need to that value within the repeated node set so that it gets set
for every person. Then, you calculate the sum outside the repeat group
after you’ve gone through every person. Please note that you’ll no longer
to calculate anything like the “previous” count in this design - you’ll
just set this value to 1 or 0 for each repeat iteration, then sum
everything at the end.

Best,
Will

··· On Sat, May 16, 2015 at 4:51 AM, Tewelde Aregawi wrote:

Hello

I tried like you suggested me and the result is 0 and 1.The current value
is overwriting the previous value

prev_men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 , 1, 0)

men_aged_15_and_59 = sum(/data/prev_men_aged_15_and_59)

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

On Sat, May 16, 2015 at 9:05 AM, Tewelde Aregawi teweldino.mvp@gmail.com wrote:

Dear william

Thanks for the quick response

Actually this was the error i am seeing

Errors making a new version:

  • Validation Error: Dependency cycles amongst the xpath expressions
    in relevant/calculate

More information:
Markup: 1 Unrecognized attributes found in Element [upload] and will
be ignored: [mediatype]
Markup: 1 Unrecognized attributes found in Element [upload] and will
be ignored: [ref]
Error: XPath Dependency Cycle:
/data/Register_peoples_live/sex_name => /data/men_aged_15_and_59
/data/Register_peoples_live/sex_name => /data/woman_aged_15_and_59
/data/men_aged_15_and_59 => /data/prev_men_aged_15_and_59
/data/prev_men_aged_15_and_59 => /data/men_aged_15_and_59
/data/woman_aged_15_and_59 => /data/prev_woman_aged_15_and_59
/data/Register_peoples_live/age_name => /data/men_aged_15_and_59
/data/Register_peoples_live/age_name => /data/woman_aged_15_and_59
/data/prev_woman_aged_15_and_59 => /data/woman_aged_15_and_59
in form

could you please explain more when you say call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum across
these nodes and derive your desired value.It would be best if you can show
me one example.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype

On Fri, May 15, 2015 at 9:39 PM, William Pride wpride@dimagi.com wrote:

Hello,

Could you describe what behavior you’re seeing when you say its not
working?

When debugging calculates like this its often useful to break up the
constituent parts of the calculate and put them in a label IE:

/data/Register_peoples_live/sex_name = “male”
/data/Register_peoples_live/age_name >=15
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59

Could all be displayed in a label so that you can identify what parts
aren’t behaving as expected.

Unfortunately I think there might be some other issues with your
construction - for example, if someone were to swipe backwards to return to
a previous person, that calculate would fire again and potentially double
count that person.

One alternative design pattern might be to have some hidden variable
that takes the value 1 if the person meets the criteria and zero otherwise,
IE for men:

/data/meets_criteria = if(/data/Register_peoples_live/sex_name = "male"
and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 , 1, 0)

Then, you could call sum
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-sum across
these nodes and derive your desired value. A similar pattern could be used
for the child count.

Best,
Will

On Sat, May 16, 2015 at 12:20 AM, Tewelde Aregawi < teweldino.mvp@gmail.com> wrote:

we are developing Household survey apps.we have created repeat group
that registers all people leaving with in the household head including
their age and sex. From this we need to store all woman with age range 15
and 59,all men with age range 15 and 49 and all children under 5 in hidden
value from the repeat group automatically without asking the household
head again.

To do this we have created hidden values and set the calculate
condition as shown below

prev_men_aged_15_and_59 = coalesce(/data/men_aged_15_and_59, 0)

prev_woman_aged_15_and_59 = coalesce(/data/woman_aged_15_and_59, 0)

men_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“male” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_men_aged_15_and_59+1, /data/prev_men_aged_15_and_59) .This will
store for the choice value male selected and age range between 15 and 59
entered.

woman_aged_15_and_59 = if(/data/Register_peoples_live/sex_name =
“female” and /data/Register_peoples_live/age_name >=15 and
/data/Register_peoples_live/age_name <=59 ,
/data/prev_woman_aged_15_and_59+1, /data/prev_woman_aged_15_and_59) .The
same which store number of woman

children_under_5 = if( /data/Register_peoples_live/age_name <=
5,/data/number_of_peaples_staying,’ ').For storing children under 5 age
entered.

Unfortunately this is not working. Could somebody help me how to fix
this .The way we thought it would work is not working.

Tewelde Aregawi

E-Health Specialist

MVP(MDE)

Tigray/Hawzein

Mobile +251933730215
Skype : tewelde.aregawi1
Face Book : tewelde aregawi

Courage, Strength, Determination, Compassion, Loyalty, Selflessness and
Confidence
Call
Send SMS
Add to Skype
You’ll need Skype CreditFree via Skype


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.


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.


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.