# Modeling conditional algorithm

Hi all,

I need some help converting some algorithm logic into xform logic–and
hoping this can be done without going manual?

Each response to a series of questions adds, subtracts, or does not affect
a score. Here are the 3 question types:

Question 1
Question 2
Question 3

The outcome of the algorithm is dependent on the final score that someone
achieves.

Thanks,
Jon

make the select of each choice the numerical value and then add all
the select answers together at the end?

··· On Tue, Jan 15, 2013 at 7:07 AM, Jonathan Payne wrote:

Hi all,

I need some help converting some algorithm logic into xform logic–and
hoping this can be done without going manual?

Each response to a series of questions adds, subtracts, or does not affect
a score. Here are the 3 question types:

Question 1
Question 2
Question 3

The outcome of the algorithm is dependent on the final score that someone
achieves.

Thanks,
Jon

Hi Jonathan,

As Drew said, you’ll need to set the value of each of the choices for each
question to your numerical value. Then, in the calculate condition for the
question that is storing the final score, you can sum up the values.
You’ll need to convert the question values to numbers (since they’re
stored as text).

For example, your calculate condition for you example would be:
int(/data/question_1) + int(/data/question_2) + int(/data/question_3)

Thanks!
Sheel

··· On Tue, Jan 15, 2013 at 6:23 PM, Drew Roos wrote:

make the select of each choice the numerical value and then add
all the select answers together at the end?

On Tue, Jan 15, 2013 at 7:07 AM, Jonathan Payne paynejd@gmail.com wrote:

Hi all,

I need some help converting some algorithm logic into xform logic–and
hoping this can be done without going manual?

Each response to a series of questions adds, subtracts, or does not
affect a score. Here are the 3 question types:

Question 1
Question 2
Question 3

The outcome of the algorithm is dependent on the final score that someone
achieves.

Thanks,
Jon

Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282

if you’re adding things together, the conversion to numeric should happen
implicitly, so i think the int() is unnecessary

··· On Tue, Jan 15, 2013 at 8:03 AM, Sheel Shah wrote:

Hi Jonathan,

As Drew said, you’ll need to set the value of each of the choices for each
question to your numerical value. Then, in the calculate condition for the
question that is storing the final score, you can sum up the values.
You’ll need to convert the question values to numbers (since they’re
stored as text).

For example, your calculate condition for you example would be:
int(/data/question_1) + int(/data/question_2) + int(/data/question_3)

Thanks!
Sheel

On Tue, Jan 15, 2013 at 6:23 PM, Drew Roos droos@dimagi.com wrote:

make the select of each choice the numerical value and then add
all the select answers together at the end?

On Tue, Jan 15, 2013 at 7:07 AM, Jonathan Payne paynejd@gmail.comwrote:

Hi all,

I need some help converting some algorithm logic into xform logic–and
hoping this can be done without going manual?

Each response to a series of questions adds, subtracts, or does not
affect a score. Here are the 3 question types:

Question 1
Question 2
Question 3

The outcome of the algorithm is dependent on the final score that
someone achieves.

Thanks,
Jon

Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282

Now that told me how, that seems pretty obvious! Thanks Drew and Sheel.

··· -- Jonathan Payne, MS 615.579.5413 skype: jonathandavidpayne

On Tue, Jan 15, 2013 at 8:05 AM, Drew Roos droos@dimagi.com wrote:

if you’re adding things together, the conversion to numeric should happen
implicitly, so i think the int() is unnecessary

On Tue, Jan 15, 2013 at 8:03 AM, Sheel Shah sshah@dimagi.com wrote:

Hi Jonathan,

As Drew said, you’ll need to set the value of each of the choices for
each question to your numerical value. Then, in the calculate condition
for the question that is storing the final score, you can sum up the
values. You’ll need to convert the question values to numbers (since
they’re stored as text).

For example, your calculate condition for you example would be:
int(/data/question_1) + int(/data/question_2) + int(/data/question_3)

Thanks!
Sheel

On Tue, Jan 15, 2013 at 6:23 PM, Drew Roos droos@dimagi.com wrote:

make the select of each choice the numerical value and then add
all the select answers together at the end?

On Tue, Jan 15, 2013 at 7:07 AM, Jonathan Payne paynejd@gmail.comwrote:

Hi all,

I need some help converting some algorithm logic into xform logic–and
hoping this can be done without going manual?

Each response to a series of questions adds, subtracts, or does not
affect a score. Here are the 3 question types:

Question 1
Question 2
Question 3