I have a get_hivaids() method which gives (results) a list of values. I want to display individual values(items) from the list across my report. My get_hivaids() method looks like this;
def get_hivaids(self,date_start,date_end):
self.cr.execute("select sum(hiv_consultation::int) as hiv_consultation, sum(pre_test_counselling::int) as pre_test_counselling, \
sum(rapid_test::int) as rapid_test, sum(post_test_counselling::int) as post_test_counselling, \
sum(post_test_counselling::int) as post_test_counselling, sum(risk_reduction::int) as risk_reduction, \
sum(arv::int) as arv, sum(oi::int) as oi, sum(cd4::int) as cd4, sum(viral_load::int) as viral_load, \
sum(prophylaxis::int) as prophylaxis, sum(sampling_procedure::int) as sampling_procedure \
from emr_client_hivaids as ech inner join emr_client as ec on ech.client_id=ec.id where ec.sex = 'm' \
and ech.date_serviced >= %s and ech.date_serviced <= %s "\
,(date_start,date_end))
res2=self.cr.dictfetchall()
return res2
This is the RML code:
[[get_hivaids(data['form']['date_start'],data['form']['date_end']) ]]
I get the following result in my report:
[ {'risk_reduction': 0L, 'oi': 1L, 'arv':1L, 'prophylaxis': 0L, 'rapid_test': 0L, 'post_test_counselling': 1L, 'cd4': 0L,
'sampling_procedure': 1L, 'pre_test_counselling': 0L, 'viral_load': 1L, 'hiv_consultation':1L}] ]
How do I get individual results from the list?