Can a Dataform activity be set up to give feedback related to category total?

Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -
Number of replies: 17

Hi all,

I would like to set up an assessment with three categories, each with four rated multiple choice questions. After the assessment the user should see Feedback A, Feedback B and Feedback C, each Feedback based on the respective category total (see below). Is this possible with Dataform? Where can I find some helpful ideas, how to set up this assessment?

With kind regards,

Hartmut


Category A

 

 

 

Question #1

Question #2

Question #3

Question #4

3/Answer 1

3/Answer 1

3/Answer 1

3/Answer 1

2/Answer 2

2/Answer 2

2/Answer 2

2/Answer 2

1/Answer 3

1/Answer 3

1/Answer 3

1/Answer 3



Category B

 

 

 

Question #1

Question #2

Question #3

Question #4

3/Answer 1

3/Answer 1

3/Answer 1

3/Answer 1

2/Answer 2

2/Answer 2

2/Answer 2

2/Answer 2

1/Answer 3

1/Answer 3

1/Answer 3

1/Answer 3


Category C

 

 

 

Question #1

Question #2

Question #3

Question #4

3/Answer 1

3/Answer 1

3/Answer 1

3/Answer 1

2/Answer 2

2/Answer 2

2/Answer 2

2/Answer 2

1/Answer 3

1/Answer 3

1/Answer 3

1/Answer 3


Category A: 10-12 Feedback A (high)

Category A: 7-9 Feedback A (average)

Category A: 4-6 Feedback A (low)


Category B: 10-12 Feedback B (high)

Category B: 7-9 Feedback B (average)

Category B: 4-6 Feedback B (low)


Category C: 10-12 Feedback C (high)

Category C: 7-9 Feedback C (average)

Category C: 4-6 Feedback C (low)

Average of ratings: -
In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

It should be possible with Dataform formulas and a bit of css. The idea is to add all feedbacks to the display page hidden by default and revealed by a designated css classes. The trick is to name the css classes in the container elements in such a way that would apply to the specified ranges and use formulas as part of the class name in the template.

The css classes could be defined as:

.fbCat {
display: none;
}

.fbA33,
.fbA22,
.fbA11,
.fbB33,
.fbB22,
.fbB11,
.fbC33,
.fbC22,
.fbC11 {
display: block;
}

In the template we need to assign the classes to the container elements. The fbCat should be assigned to all so as to hide the feedback by default. The other css class should be calculated because it depends on the user selection of the options. So, for the feedback of Category A: 10-12 Feedback A (high) we could have something like:

<div class="fbCat fbA3%%...%%">This is the feedback of Category A: 10-12</div>

The %%...%% is a Dataform formula that aggregates the user selections in category A. Assuming we have the select or radiobutton fields QA1, QA2, QA3, QA4 for the questions of category A. The pattern [fieldname:key] will return the key value of the selected option. For instance, with the options

Good
Very good
Excellent
Wow

and selected 'Excellent' the pattern [fieldname:key] will return 3.

We can define the formula for Category A as:

%%F:=ROUND((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/4)-0.25)%%

This should normalize the ranges in the following way

4-6 => 1

7-9 => 2

10-12 => 3

So, depending on the user selection

fbA3%%F:=ROUND((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/4)-0.25)%%

should give fbA31 or fbA32 or fbA33. With the first two the high feedback of category A will remain hidden. With the last it will be displayed.

smile


Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

Many thanks for your very detailed response. This is exciting and I am glad that the assessment can be done without using JS for the calculation. I hope I can try out your suggestions tonight.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

The formula described above will work only for some of the cases. A better formula is the following:

%%F:=FLOOR((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/3)-0.1)%%

smile

In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

I tried my best the entire evening, but I was not successful. I defined Question #1 with a radio button and "QA1" in Template. For Question #2 I added "QA2" in Template and similar for Question #3 and #4.

Question #1 with radio button






























In Custom Styles for all views I added the CSS code:

.fbCat {

   display: none;

}


.fbA33,

.fbA22,

.fbA11,

.fbB33,

.fbB22,

.fbB11,

.fbC33,

.fbC22,

.fbC11 {

    display: block;

}


In the entry template I added:

<div class="entry"><table class="generaltable"><tbody><tr class="r0"><td class="cell c0" style="text-align:right;width:100px;">Question #1 (Category A):</td>

<td class="QA1">Question #1 (Category A)</td>

</tr><tr class="r1"><td class="cell c0" style="text-align:right;width:100px;">Question #2 (Category A):</td>

<td class="QA2">Question #2 (Category A)</td>

</tr><tr class="r0"><td class="cell c0" style="text-align:right;width:100px;">Question #3 (Category A):</td>

<td class="QA3">Question #3 (Category A)</td>

</tr><tr class="r1"><td class="cell c0" style="text-align:right;width:100px;">Question #4 (Category A):</td>

<td class="QA4">Question #4 (Category A)</td>

</tr><tr class="r0 lastrow"><td class="cell c0 lastcol" colspan="2">EAC:edit  EAC:delete</td>

</tr></tbody></table></div>


In the view template I added:

<div><div class="exporthide"><div class="addnewentry-wrapper">##addnewentry##</div><div class="quickfilters-wrapper"><div class="quickfilter">Current filter ##filtersmenu##</div><div class="quickfilter">Search ##quicksearch##</div><div class="quickfilter">Per page ##quickperpage##</div><div class="clearfix"></div></div><div>##paging:bar##</div></div><div>##entries##</div></div>


<div class="fbCat fbA%%F:=FLOOR((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/3)-0.1)%%"></div>


<div class="fbCat fbA3%%...%%">This is the feedback of Category A: 10-12</div>

<div class="fbCat fbA2%%...%%">This is the feedback of Category A: 7-9</div>

<div class="fbCat fbA1%%...%%">This is the feedback of Category A: 4-6</div>



new entry


















Saved entry - no calculation, no feedback














Do you see where I misunderstood your instruction? I am not in a hurry and can probably only try out something next weekend, but I would appreciate your feedback.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

QA1 in my explanation stands for the field name. In your test activity you set the field name to Question #1(Category A). The field name is what you use in the patterns. It is a good practice to keep it short and simple. So, start with changing the field names to QA1, QA2 etc.

The field template setting (where you put QA1 in your illustration) is not currently working so no matter what you put there it will have no particular effect at this point (fixed but not yet released).

The keys are the options' ordinal numbers. The key of the first option is 1, the key of the second is 2, and so on. At this point there is no standard way to reverse the order in display, but it is a good idea for improvement and if you add a tracker issue it will be taken into consideration.

The css class of the container elements are not set properly. The only div in your example that has the formula will always be hidden and at any rate has no content so you cannot tell if and when it is displayed .

Try the following

<div class="fbCat fbA3%%F:=FLOOR((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/3)-0.1)%%">This is the feedback of Category A: 10-12</div>

<div class="fbCat fbA2%%F:=FLOOR((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/3)-0.1)%%">This is the feedback of Category A: 7-9</div>

<div class="fbCat fbA1%%F:=FLOOR((([!QA1:key]+[!QA2:key]+[!QA3:key]+[!QA4:key])/3)-0.1)%%">This is the feedback of Category A: 4-6</div>

Also, this part of the html has to be in the Entry template because it refers to entry fields and has to be processed separately for each entry.

smile

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

Note also that the field patterns in the forumals should be enclosed with double square brackets. Cannot show that in the post because double square brackets here are filtered to docs links. smile

In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

Thanks a lot for both responses. I am sorry to bother you again. Although I spent all morning, I am still unable to get the assessment tool working properly. HERE is the link to the preset of the Assessment tool. (632 KB in Dropbox)

I shortened the field names to QA1 (default value in field attributes: 1), QA2 (default value in field attributes: 1), etc. Is it correct to set the default value for every question to 1 in Field attributes?

Field - default value






















I set up 2 views. One view "Questions" is like "Add entry" in Database

Entry template

















Below is the entry template in plain text:

Entry template - plain text













After submission, the user will see the Feedback view. 

Feedback view - view template












Below is the same view in plain text.

Feedback view - view template in plain text












In new entry I select answers:

adding a new entry














As a feedback, I get this (see below):

Feedback to new entry


a) I am not sure how to reference fbA3%%, the result of the calculation in the Feedback view, done on the Questions' page in the entry template. 

b) I am not sure whether there is any calculation done at all. Perhaps something is wrong in the table of the entry template of the Questions' page.

Do you see what is missing or wrong?

With kind regards,

Hartmut


In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

I changed the view template to:

updated view template










Then, I checked 4x Answer #1. This is what I get:

result of checking 4x Answer #1








There should only be one answer instead of three. Any idea what I need to change?

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

I started a fresh Dataform activity, named it Assessment Tool (generic), added the CSS (see above) and 4 fields. This time I picked "select" instead of "Radio button." Here is the field for question #1.

field




























Then I added a Grid view (Questions). The entry template looks like this:

Entry template (Grid view)














I did not change anything in the view template in "Questions."

I added another Grid view and named it Feedback. Here I changed the view template (see below):

view template (Feedback; Grid view)









When I select the answers to the questions, I get no line of feedback. At the moment I don't know whether this happens because something is wrong in the view template or because there is no calculation at all. Here is the link to the Preset of this Dataform activity. Any feedback is highly appreciated.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

I'll create a tutorial for this today or tomorrow. Stay tuned. smile

In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

It turns out the the fieldname:key pattern has been broken. The good news is that after a quick fix the view works as expected and the feedback is displayed according to selection. The fix will be released over the weekend. A tutorial for this kind of application will be posted soon. smile

In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Thank you, Itamar, for both responses and for fixing the fieldname:key pattern. I am looking forward to using the Dataform activity as an assessment tool.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

Here is a tutorial for building a Dataform activity which displays feedback by category total. Let me know if this tutorial is clear. The required adjustments in the Dataform will be released soon. smile

Average of ratings: Useful (2)
In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

Thank you for the detailed and clear tutorial for an online assessment tool. I set up the Dataform activity with this tutorial and will test it as soon as you have released an updated version of Dataform. Thanks a lot for maintaining the Dataform activity.

With kind regards,

Hartmut

In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

Excellent work and highly appreciated. I installed the updated Dataform activity and it works in Moodle 2.7 and 2.8. I am excited that I can use this activity for giving feedback by category totals. Thanks also for the tutorial. It's good to understand and I am sure it will be useful for many people. Just one minor thing. Could you either change the number of answers to three (so 4 questions, but 3 answers) or add one more feedback for category total 13-16?

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Can a Dataform activity be set up to give feedback related to category total?

by Itamar Tzadok -

With 4 cateogries and 4 question options, the formula would have to be something like the following:

Category Range Formula Result
A 1-4 CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4) 1
B 5-8 CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4) 2
C 9-12 CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4) 3
D 13-16 CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4) 4

Then you add the feedback divs in the entry template:

<div class="fbCat fbA1%%F:=CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4)%%">This is the 1-4 feedback of Category A</div>

<div class="fbCat fbB2%%F:=CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4)%%">This is the 5-8 feedback of Category A</div>

<div class="fbCat fbC3%%F:=CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4)%%">This is the 9-12 feedback of Category A</div>

<div class="fbCat fbD4%%F:=CEIL(([[!QA1:key] ]+[[!QA2:key] ]+[[!QA3:key] ]+[[!QA4:key] ])/4)%%">This is the 13-16 feedback of Category A</div>


In the css:

.fbCat {
    display:none;
}

.fbA11, .fbB22, fbC33, fbD44 {
   display: block;
}

Does that help? smile
Average of ratings: Useful (1)
In reply to Itamar Tzadok

Re: Can a Dataform activity be set up to give feedback related to category total?

by Hartmut Scherer -

Hi Itamar,

Thank you for your reply and for adding the formulas for 4 questions with 4 options. Inspired by your post and using FLOOR and CEIL, I started playing with 2 categories, 4 questions, 4 options and the feedback #1 to 4-6, feedback #2 to 7-9, feedback #3 to 10-12 and feedback #4 to 13-16. I attached a preset, which should work in Moodle 2.7 and 2.8.

With kind regards,

Hartmut

Average of ratings: Useful (2)