Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

RML report display problem?

By
Alec Mouti
on 8/5/14, 12:23 PM 761 views

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?

 

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/5/14, 12:23 PM
Seen: 761 times
Last updated: 3/16/15, 8:10 AM