I've been trying to use my current business object and filtering it
depending on user input.  This will allow the user to interactively
limit the number of records appearing in a grid.  I really like the
filter and removeFilters methods.

 

This worked fine:

 

self.PrimaryBizobj.filter("completed_date", None)

 

But, my next filter is a little more complicated.  I'm using MySQL as
the database and would like to search for a string that could be
anywhere inside a field.

 

The following works, but I also need to remove the case sensitivity.

 

            self.PrimaryBizobj.filter("name_field", search_string,
"contains")

 

I thought this would work...

 

            self.PrimaryBizobj.filterByExpression("lower(name_field)
like '%mike%'")

 

But, I'm getting an error:

 

[rec for rec in self if lower(rec['name_field']) like '%mike%']

SyntaxError: invalid syntax

 

The SQL statement works fine natively in MySQL.  What would be the
correct syntax for the Dabo filterByExpression method?  Also, what would
be the correct syntax to use when adding a variable into the
filterByExpression parameter?

 

For example:

 

def filterNameRequest(self, search_string):

    if search_string != "":

        self.PrimaryBizobj.filterByExpression("lower(name_field) like
'%search_string%'")

    else:

        self.PrimaryBizobj.removeFilters()

    self.update()

 

Thanks,



Mike Coop
Data Analyst III

Kemper Preferred
12926 Gran Bay Parkway West, Jacksonville, FL 32258
904.245.5949
[email protected]
kemper.com


CONFIDENTIALITY NOTICE: This communication may contain confidential information 
intended only for the addressee(s). If you received this communication in 
error, please notify the sender and delete it from your system.
 

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/ea3f09e331105045bee09923c85d8d2630cf3...@kahjaxex1.unitrininc.unitrin.org

Reply via email to