Hi Clayton,****
I built an app using the syntax as suggested by you (below mail) and could
successfully do so except for one problem, described here:****
The logic of the quiz is :****
Ask Q1-i ( single select) , if the answer is correct give 20 marks , else
0 marks,****
Ask Q2-i ( single select) , if the answer is correct give 20 marks , else
0 marks,****
[Show only if Q1-i was answered wrong i.e. value= 0, else skip] Ask
Q1-ii ( single select) , if the answer is correct give 10 marks else 0
marks,****
[Show only if Q2-i was answered wrong i.e. value= 0, else skip]Ask
Q2-ii ( single select) , if the answer is correct give 10 marks else 0
marks,**
Data node calculates total score = *Q1-I + Q2-I + Q1-ii + Q2-ii *
Label shows the “total score is (i.e. 0/10/20/30/40) out of 40”****
But the label shows :****
1. CORRECT output text in case user traverses through all
questions
2. NO OUTPUT (total score) text i.e. “total score is out of
40” in all other cases where user answers either or both of the first 2
questions correctly which means at least one of the following questions
were skipped.
I think it’s about default values of the skipped questions and I tried
setting them up but to no avail.****
Please suggest, how to go about it.****
warm regards,****
girdhari****
From: commcare-users@googlegroups.com [mailto:
commcare-users@googlegroups.com] *On Behalf Of *Clayton Sims
Sent: Thursday, March 15, 2012 10:05 PM
To: commcare-users@googlegroups.com
Subject: Re: Default message/Label in local language(Hindi) ??****
Ghirdari,****
There are a few components here that you'll need to configure. Also, some
of these things are supported more cleanly than others, and we're
continuing to roll in better support for some of the aspects you write
manually here. In any case, here is what you'll need to configure.****
- Data Nodes.****
Data nodes are places to calculate and store values without having a
question asked to the user. The important element for your use is the *
calculate* field. Depending on how you plan on scoring the test, this
field will look different. We'll assume you'll be scoring your test in the
format of assigning point values to individual answers. The easiest way of
doing so is to make all of the select values numbers, so each item in a
select is set to an id value of something like 3 or 0.****
If all that is true, your data node's calculate would look something like*
int(/data/question_one) + int(/data/question_two) +
int(/data/question_three)****
where data is the form name in the form properties pane in Vellum
on the right side (it's data by default), and question_one, etc are
the id's under Question ID in the middle pane. This also assumes your
form doesn't have any groups in it.****
So now we have a data node which contains an integer value which is the
score on the test. There are two tasks remaining.****
- Outputting data in labels****
Feeding data into a question label is unfortunately a fairly rough user
experience. Essentially you'll need to manually feed in the XML markup that
the form uses to accomplish this. ****
First, find the Question ID of the data node created in the first
section. Now, create the Label where you'll be displaying this value,
and put in your text along with the bolded section below into the Display
Text****
You have scored out of 100 marks!*
*
Where data_node_id is the id of the data node. This reference is the
same format used in the first section. This should accomplish displaying
the raw number.****
This would be a good time to roll out a build and test whether things are
working. Once you've verified the number is being displayed we can work on
getting a calculated label.****
- Calculating a derived value, and displaying conditional localized text.
There are two ways to accomplish the last item you've mentioned here.
We'll assume for simplicity that we want to display between 3 different
messages for (Good, Alright, Poorly), and that we want to do the
easier option. ****
The most straightforward is to create three different Label questions,
each of which will represent one of the labels. One big advantage of this
is that you can fully customize the message. "You scored 100 marks! Great
job!" v. "You only scored 30 marks, you need improvement". ****
First, create the three Label questions, and set up their text and the
output inside of them.****
Then, in the Skip Condition, you will enter a value which will be True
if the label should be displayed, and False otherwise (apologies for the
confusing name). We'll say that Good is greater than 75, Alright is between
75 and 50, and poorly is below 50. The three conditions would be****
/data/data_node_id > 75****
/data/data_node_id <= 75 and /data/data_node_id > 50****
/data/data_node_id <= 50****
respectively. You can enter these using the Edit button in Vellum next
to the Skip Condition and filling out the conditions for the node (you
can also drag the node into the box, instead of having to type it out).***
*
- Advanced (even more) localized outputs****
If you've got many categories instead of just 3, it might be a burden to
maintain something like 10 different output labels, in which case
displaying the "good/alright/poor" style text can occur in its own
framework. There are a couple ways to do this, but we'll cover the high
level method. I won't go into as much detail on this section, but it might
be worth experimenting with****
First, we'll create another data node where we're going to stick a new
calculated value. This value will be an id string which represents the
message we want to display (g, a, p). ****
We calculate this value similarly to how we did the skip conditions in
part 3, but we'll need to type them out by hand instead. We'll also use the
"if" function, which checks an expression, and sets the value to the first
item if it is true, and the second if it is false. We don't need to put in
all of the cases explicitly here, because some of them are implicit (We
only calculate the second 'if' statement if the first is false, so we
already know the score is <= 75, for instance).****
if( /data/data_score > 75, 'g', if( /data/data_score > 50, 'a', 'b'))****
Now our new data node (call it /data/quality) contains one of (g,a,p).
We only need one Label now, and we'll set it's display text to be ****
You have scored * out of 100
marks! <output ref="jr:itext(/data/quality")/>***
the jr:itext function here will display text in the correct language of
the form based on the id argument given. So the last thing we need to do is
to make sure that the form has text for those id's. To do so we'll have to
export the form's text, add the values, and re-import it. You can do so
under Advanced -> Edit Bulk Translations on the right hand panel. The *
ID* for the translations should be g or a or p for the three
respective translations.****
This is a lot to process, of course, but it should be a good foundation to
get started. Please let me know if you have trouble with any of these steps.
Cheers!****
-Clayton****
On Tue, Mar 13, 2012 at 12:38 PM, Girdhari Bora gbora@intrahealth.org
wrote:****
Hello everyone,****
We are preparing a quiz for ASHAs in CommCare and want the quiz to be
evaluated based on the responses.****
I could develop a simple quiz with a simple logic but intend to evaluate
responses of the user and than at the end present user with the total
score. I could not get much literature on how to go about it in CommCare.*
I want to know how does one use Data Nodes ( an example will be perfect) ?
and How to show conditional text on the label/Prompt for e.g. “You have
scored *100 *(calculated) marks, Good **(this text may change based on
the total score)” ****
Looking forward to the responses.****
warm regards,****
girdhari****
From: commcare-users@googlegroups.com [mailto:
commcare-users@googlegroups.com] On Behalf Of Clayton Sims
Sent: Monday, March 12, 2012 9:12 PM
To: commcare-users@googlegroups.com
Subject: Re: Default message/Label in local language(Hindi) ??**
Girdhari,****
The message****
Form Complete, thanks!****
is encoded by the translation key****
sending.view.done****
and the "Done" button's translation is encoded by the key****
button.Next****
If you update these in the User Interface Translations section of the
application builder, it should change the translations. Please let me know
if you have any difficulties.**
Regards,****
-Clayton****
On Sun, Mar 11, 2012 at 5:31 AM, Girdhari Bora gbora@intrahealth.org
wrote:****
Hi all,****
Can we have the following two messages/labels in Hindi in CommCare. We are
soon deploying one application with ASHAs (CHWs) and if we can have the
message/Label (in pics below) in HINDI, it will be very helpful.****
-
Can *Done* be called as “*आगे*”. ****
[image: Done_instruction.jpg]****
-
Can we have the finished message in Hindi.****
[image: Finished screen.jpg]****
warm regards,****
girdhari****