Lino Website

Documentation · Modules · adamo · Examples

This example shows how to set a search filter and the depth=1 argument on a detail column.

Source code:

from lino.apps.contacts.contacts_demo import startup
from lino.apps.contacts.contacts_tables import Nation
from lino.adamo.filters import NotEmpty

dbc = startup(big=True)
qry=dbc.query(Nation,"id name")
    columnWidths="2 15 *",
    title="Nations and their Cities containing search string 'dre'")

print qry.getSqlSelect()

del dbc, qry


Nations and their Cities containing search string 'dre'
id|name           |cities                                  
be|Belgium        |Audregnies (be), Berendrecht (be),      
  |               |Drehance (be), Gondregnies (be),        
  |               |Houdremont (be), Jandrain-Jandrenouille 
  |               |(be), Kieldrecht (be), Merendree (be),  
  |               |Mont-Saint-Andre (be), Saint-Andre (be),
  |               |Wandre (be), Warnant-Dreye (be), Waudrez
  |               |(be), Xhendremael (be), Zwijndrecht (be)
de|Germany        |Drebkau (de), Dreieich (de),            
  |               |Drensteinfurt (de), Dresden (de), Sankt 
  |               |Andreasberg, Bergstadt (de)             

SELECT id, name_en FROM Nations WHERE EXISTS (SELECT * FROM Cities WHERE AND name LIKE '%dre%' OR zipCode LIKE '%dre%' ORDER BY name)

Refering articles:

Copyright 2001-2007 Luc Saffre.
Generated 2007-06-07 16:23:40