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 cities") qry.addColFilter('cities',NotEmpty) qry.show(columnWidths="2 15 20") print print qry.getSqlSelect() del dbc, qry
Output:
Nations where 'cities' not empty ================================ id|name |cities --+---------------+-------------------- ee|Estonia |10 Cities be|Belgium |9 Cities de|Germany |7 Cities SELECT id, name_en FROM Nations WHERE EXISTS (SELECT * FROM Cities WHERE nation_id=Nations.id)
Refering articles:
- filters1.py needs DetailColumn (code changes 04.03.06) — I noticed that filters1.py and filters2.py show a rather serious problem of the new paradigm for handling details. It sets a filter on a detail column. But I thought such columns to disappear. How can I convert filters1.py to the new paradigm? Answer: DetailColumn remains.
- filters on subqueries: first success (06.05.05) — Uff! Filtering on subqueries (see examples filters1.py and filters2.py) works finally. Soon I will use this for Keeper.