Moving this email from Roger to the list.
When are calculated variables supposed to be calculated? I defined a simple numeric data element with 2 disaggregation groups and a calculated element representing the sum of the 2 disaggregation groups. I put them in a dataset and went to enter data.
The total of the disaggregation will automatically be calculated when you query the total value for the data element. E.g. if I have a data element “BCG doses given” and two categories “EPI Age” and “Fixed/Outreach” with options (<1, >1) and (fixed, outreach), the total of “BCG doses given” is the sum of the four data values for that data element with the four different catoptioncombos. This total can be used directly in report tables, pivot tables etc. and there is no need to define a new calculated data element to get this total (or any of the subtotals). Calculated data elements make more sense when you would like to add together different data elements (and possibly their catoptioncombos, and not different combinations of options for the same element.
The program seemed to expect data entry for the calculated variable. I then defined a validation rule that the calculated variable should equal the sum of the disaggregated groups. The validation failed showing the value of the calculated variable as zero. So I put the two variables into a data mart export and ran the export. The validation rule still failed in the same way. The calculated variable appears in all the right places in datavalue and aggregateddatavalue, it’s just that its value is unifoermly zero.
I think the desired behavior would be for calculated variables to be updated whenever one of their components is updated and for them to appear as read-only fields on data entry forms.
Calculated data elements are normally calculated as part of the data mart export, and I assume also by the on the fly aggregation service which is being used by many of the output modules such as charts, GIS, report tables. Lars will have to comment on that. So in this way the calculated data element becomes something like an indicator (at least the numerator).
When creating a data element you have the option to tick “Saved”. This means that the calculated value will also be saved in the raw data value table (datavalue), and not only in the aggregateddatavalue table. I believe that these “saved” calculated values are generated in the data entry module when the user clicks on the “Save Calculated Data” button in the top right corner.
I must I admit I am not 100% how this works, the devs will have to add more detail to this.
I also would like to see the calculated values appear in the data entry form as read only values, and I thought that was the purpose too, but this does not seem to work at the moment.
Thanks for your feedback and comments Roger.
On 14 September 2010 16:46:22 UTC+2, Friedman, Roger (CDC/CGH/DGHA) (CTR) firstname.lastname@example.org wrote: