How can I enable a calculation that allows zero in a text field?

How can I enable a calculation that allows zero in a text field?

by Hartmut Scherer -
Number of replies: 6

Hi all,

I use Dataform for case studies. 

Dataform with point













After the students have entered their answers, I write a comment and add the points in that section. Here is the setup of the field:

field text





















If a student has not answered a question in a section and I give zero points, the points will not be saved nor will there be a total. How can I enable a calculation that allows zero in a text field? The formula for the total is (added extra space between ):

<div><b>%%F[ [11_total:=[ [!10_points1]]+[ [!10_points2]]+[ [!10_points3]]+[ [!10_points4]]+[ [!10_points5]]+[ [!10_points6]]+[ [!10_points7]]+[ [!10_points8]]%%</b></div>

With kind regards,

Hartmut

Average of ratings: -
In reply to Hartmut Scherer

Re: How can I enable a calculation that allows zero in a text field?

by Hartmut Scherer -

I forgot to mention that I use Moodle 2.8.3 with Dataform 2.8.5 (2014111005).

In reply to Hartmut Scherer

Re: How can I enable a calculation that allows zero in a text field?

by Itamar Tzadok -

Alas that's a bug which affects also 2.8.6 (available from git). Please report in the tracker.

As a workaround you can use either the number field or the select field. The number field doesn't store a 0 but displays a 0 when empty. That might not be ideal for grading though. With the select field you can enter numeric options starting with 0. This is both stored and displayed.

The use case probably calls for a grading form (rubric). This is supported by the Dataform but some required Dataform components are yet to be released.

hth smile

In reply to Itamar Tzadok

Re: How can I enable a calculation that allows zero in a text field?

by Hartmut Scherer -

Hi Itamar,

Thanks a lot for sharing the workaround with the select field. Initially, it is more work to set up a Dataform activity with a marking guide or rubric like I did, but I like the fact that I can add a comment and the points right behind the entry of the student. 

With kind regards,

Hartmut

In reply to Itamar Tzadok

Re: How can I enable a calculation that allows zero in a text field?

by Hartmut Scherer -

Hi Itamar,

The select field works great. Is there any way to transfer the total of a student's case study automatically into the grade book? 

<div><b>%%F[ [11_total:=[ [!10_points1]]+[ [!10_points2]]+[ [!10_points3]]+[ [!10_points4]]+[ [!10_points5]]+[ [!10_points6]]+[ [!10_points7]]+[ [!10_points8]]%%</b></div>

I used in Dataform > Edit settings - Grade: =sum(11_total)

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: How can I enable a calculation that allows zero in a text field?

by Itamar Tzadok -
If it's one entry per student, the grade calculation would be:

##:10_points1## + ##:10_points2## + ##:10_points3## + ##:10_points4## + ##:10_points5## + ##:10_points6## + ##:10_points7## + ##:10_points8##

or

SUM(##:10_points1##, ##:10_points2##, ##:10_points3##, ##:10_points4##, 
##:10_points5##, ##:10_points6##, ##:10_points7##, ##:10_points8##)

If it is more than one entry per student and you want the average, it would be:

AVERAGE(##:10_points1##) + AVERAGE(##:10_points2##) + AVERAGE(##:10_points3##) + AVERAGE(##:10_points4##) + AVERAGE(##:10_points5##) + AVERAGE(##:10_points6##) + AVERAGE(##:10_points7##) + AVERAGE(##:10_points8##)

The latter calculation would also work for the former case.


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

Re: How can I enable a calculation that allows zero in a text field?

by Hartmut Scherer -

Hi Itamar,

Many thanks for your prompt reply. The grading works. I am excited about the versality of the Dataform module and appreciate your effort and support in maintaining and further developing it. 

With kind regards,

Hartmut