Query report filters not working!

Hello every one ,
I’am creating new query report its fine and show data very fine , but filters is not working .
Any one can help me.
this is my query:

 SELECT `tabMain Center Dispatch`.name,`tabMain Center Dispatch`.patient_name,`tabMain Center Dispatch`.governorate_name,`tabMain Center Dispatch`.visit_kind,`tabMain Center Dispatch`.hospital_name 
from `tabMain Center Dispatch`
where `tabMain Center Dispatch`.governorate_name=%(governorate_name)s

it gives me KeyError: ‘governorate_name’

It would be better if you could share your code and error you are facing with us to help you.

May you help I modify my question.

@shadrak98
This is my query
SELECT tabMain Center Dispatch.name,tabMain Center Dispatch.patient_name,tabMain Center Dispatch.governorate_name,tabMain Center Dispatch.visit_kind,tabMain Center Dispatch.hospital_name
from tabMain Center Dispatch
where tabMain Center Dispatch.governorate_name=%(governorate_name)s

did you set filter field governorate_name mandatory(required) or already has value on this filter field before seeing the error message?

No it is not mandatory

I’m having the exact same problem. Did you figure this out @zaidali ?

The issue appears to happen if I set up a non-mandatory filter. When the query runs and no value is supplied for the filter, I get the above error:

KeyError: `[field_name]`

The documentation is extremely sparse when it comes to using filters in query reports. Is there better documentation out there anywhere?

This is my WHERE clause:

    (%(store)s IS NULL or wls.store = %(store)s)
    AND (%(city)s IS NULL or s.city LIKE %(city)s)
    AND (%(state)s IS NULL or s.state LIKE %(state)s)
    AND rsvns.sides IS NULL OR rsvns.sides < 2
1 Like

I have the same issue

1 Like

Hello @zaidali @ebsjbulcher and @trungus

I agree on the sparse coverage on most things related to reporting. That’s precisely why I wrote the [Tutorial] Script Report / Chart - #14 by EugeneP.

In the latter part of this tutorial, I use filters frequently and trust that it’ll help you acquiring more insight into your particular issue.

3 Likes

thank you a lot

1 Like

I solved problem using Script Report