On Saturday, 6 April 2013 00:04:24 UTC+2, Niphlod wrote:
>
> You just need to:
> - include a pkey, better if resembles a sequence, and have a Field of
> type 'id' matching it
>
>
This is not very usable. Here is an example:
In postgresql:
CREATE OR REPLACE VIEW sabinet.sabinet_records_per_journal AS
SELECT sabinet.jt AS journal, count(*) AS records
FROM sabinet.sabinet
GROUP BY sabinet.jt
ORDER BY count(*) DESC;
The pkey is 'id' in all DAL objects. I cannot add it to this view because
then I will have to include it in the 'group by' which will destroy the
purpose of the query.
I have tried with the following model:
migrate= False
db.define_table("sabinet_records_per_journal",
Field('journal'),
Field('records', 'integer'),
migrate = migrate)
But I get:
Query Not Supported: current transaction is aborted, commands ignored until
end of transaction block
No records found
When I run try the following controller:
def sabinet_records_per_journal():
response.view = 'isi/isi_grid.html'
opskrif="SABINET-data"
data = SQLFORM.grid(db.sabinet_records_per_journal, deletable = False,
editable = False,
details = False,
csv = False,
searchable = False)
return dict(data=data, opskrif=opskrif)
Regards
Johann
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.