On Wednesday, May 1, 2019 at 1:53:25 PM UTC-7, [email protected] wrote: > > Got the answer in the Telegram chat. Using eval. > It's a dangerous solution but works. > > What about storing a querey, as in <URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Query-Set-Rows> ?
/dps > > quarta-feira, 1 de Maio de 2019 às 10:07:45 UTC+1, [email protected] > escreveu: >> >> Hello, >> >> How to pass a query set string or a string with a select/count to be >> executed in another controller? >> >> On one controller I create one of these 4 examples: >> session.checks = [ >> 'db(db.equipment.sn_counter_id == request.args[0]).count()', >> T('Cannot be deleted while assigned to an equipment.'), >> ] >> >> session.checks = [ >> QUERY_FOR_COUNT, >> 'db.equipment.sn_counter_id == request.args[0]', >> T('Cannot be deleted while assigned to an equipment.'), >> ] >> >> session.checks = [ >> 'db(db.equipment.depends_on == request.args[0]).select()', >> T('Cannot be deleted while dependent on an option.'), >> ] >> >> session.checks = [ >> QUERY_FOR_SELECT, >> 'db.equipment.depends_on == request.args[0]', >> T('Cannot be deleted while dependent on an option.'), >> ] >> >> and then execute it on another controller using something similar to (of >> course my example below doesn't work): >> if session.checks[0]: >> session.flash = session.checks[1] >> redirect(return_to) >> >> Thanks, >> >> JM >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.

