Binding SQLFORM grid By query string value giving error

81 views
Skip to first unread message

Pawan Jha

unread,
May 14, 2013, 1:29:35 AM5/14/13
to web...@googlegroups.com

Hi all Please let me know why this is giving error as i need to query the table as the value comes with the query string


field = [db.call_log.call_datetime_from,db.call_log.incident_street_no,db.call_log.incident_house_no]   
    page = request.args(0)
    query = db.call_log.incident_Id == page
    # == page
    #db.define_table('call_log',Field('incident_Id'),auth.signature)
    query = db.call_log.incident_Id==page
    table= SQLFORM.smartgrid(query,
                   user_signature=True,
                   fields=field,
                   deletable=False,
                   editable=False,
                   details=False,
                   #selectable = lambda ids: clubCall(ids),
                   #field_id=None,
                   csv=False,
                   paginate=20,
                   #showbuttontext=False,
                   searchable=False,
                   #create=False,
                    oncreate=None,
                   onupdate=None,
                   ondelete=None,
                   )
                   #formargs={},
                   #createargs={},
                   #editargs={},
                   #viewargs={},
                   #buttons_placement = 'right',
                   #links_placement = 'right',
                   #ignore_rw = False,)
    #query = (db.call_log.incident_Id >0).select()

Johann Spies

unread,
May 14, 2013, 8:33:27 AM5/14/13
to web...@googlegroups.com
On 14/05/2013 07:29, Pawan Jha wrote:
> page = request.args(0)
What is the type of this 'page'?

Regards
Johann

--
Johann Spies Telefoon: 021-808 4699
Databestuurder / Data manager Faks: 021-883 3691

Sentrum vir Navorsing oor Evaluasie, Wetenskap en Tegnologie
Centre for Research on Evaluation, Science and Technology
Universiteit Stellenbosch.

"Yea, though I walk through the valley of the shadow of
death, I will fear no evil: for thou art with me;
thy rod and thy staff they comfort me." Psalms 23:4

E-pos vrywaringsklousule

Hierdie e-pos mag vertroulike inligting bevat en mag regtens geprivilegeerd wees en is slegs bedoel vir die persoon aan wie dit geadresseer is. Indien u nie die bedoelde ontvanger is nie, word u hiermee in kennis gestel dat u hierdie dokument geensins mag gebruik, versprei of kopieer nie. Stel ook asseblief die sender onmiddellik per telefoon in kennis en vee die e-pos uit. Die Universiteit aanvaar nie aanspreeklikheid vir enige skade, verlies of uitgawe wat voortspruit uit hierdie e-pos en/of die oopmaak van enige lês aangeheg by hierdie e-pos nie.

E-mail disclaimer

This e-mail may contain confidential information and may be legally privileged and is intended only for the person to whom it is addressed. If you are not the intended recipient, you are notified that you may not use, distribute or copy this document in any manner whatsoever. Kindly also notify the sender immediately by telephone, and delete the e-mail. The University does not accept liability for any damage, loss or expense arising from this e-mail and/or accessing any files attached to this e-mail.

Anthony

unread,
May 14, 2013, 8:55:47 AM5/14/13
to web...@googlegroups.com
The first argument to smartgrid should be a table, not a query. If you want to specify constraints, use the "constraints" argument, which is a dictionary specifying constraint queries for each tablename:

SQLFORM.smartgrid(db.call_log, constraints=dict(call_log=query), ...)

Anthony

Pawan Jha

unread,
May 14, 2013, 8:56:55 AM5/14/13
to web...@googlegroups.com
its normal view page ..


--
 
---
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
       Thanks  &  Regards
        Pawan Kr. Pankaj
91-9968831967/9540773888

Software Engineer (DOT .Net)
 pawan.p
an...@agnicient.com
           

Anthony

unread,
May 14, 2013, 9:57:18 AM5/14/13
to web...@googlegroups.com
I'm not sure what you mean by that.

Pawan Jha

unread,
May 16, 2013, 9:45:20 AM5/16/13
to web...@googlegroups.com
Hi
Johann Spies


as i am passing some value in url means passing value as query string

like controllername/actionname/2

i want to get all the value form table whose id = 2

and want to display this value in Smartgrid

but the present code is giving error . so please suggest me how will i use this .

Anthony

unread,
May 16, 2013, 10:17:03 AM5/16/13
to web...@googlegroups.com
What happened when you tried this solution: https://groups.google.com/d/msg/web2py/gDzXSbicFcI/BZKxpNs4GBIJ?

Also, note that in /controllername/actionname/2, the "2" is not a query string -- it is just part of the URL path, and since it comes after the action name, web2py interprets it as an arg and puts it in request.args. A query string comes after a ? and consists of name=value pairs separated by &'s -- web2py puts those variables and values into request.get_vars (and also request.vars).

Anthony
Reply all
Reply to author
Forward
0 new messages