Alpha Video Training
Results 1 to 3 of 3

Thread: filtering on session variable

  1. #1
    Member René Stout's Avatar
    Real Name
    René Stout
    Join Date
    Oct 2003
    Location
    Tiendeveen, The Netherlands, Europe
    Posts
    529

    Default filtering on session variable

    Hi,

    What am I doing wring here?

    Upon login the user gets assigned the session.var session.__protected__Praktijk.Userid with the value of User_Id.

    I have a grid in which the field Uder_ID exists as a label.

    Now I want to filter the grid, so that the user only sees the fields that have 'his' User_Id. Therefor I defined in the grid (under Advanced):
    tmpl.DBF.filter = "User_Id=\""+session.__protected__Praktijk.Userid+"\""

    But I keep seeing all the fields.

    You can see this happen if you look at http://www.rwstout.nl/dbase/html ans login as Rene, password rene.

    The welcome screen shows the session var, which should be the same as René's user_ID in screen Beheer/Users.

    Ideas?

    Greetings, René

  2. #2
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,171

    Default RE: filtering on session variable

    Rene

    What you have looks correct. However, if the session variable is numeric, sometimes the filter expression such as you defined doesn't work. If the variable is numeric, I would change it to character and create an expression to convert the field to test as a character value.

    You can also check the expression by creating a query using the same basic expression, substituting another varaible name for the session variable. Instead of

    session.__protected__Praktijk.Userid = somevalue

    populate a shared or global variable with the same value

    userid = somevalue

    Then create a query using either a default form or browse for the table using an expression like

    filter = "User_Id=\""+Userid+"\""

    This will show if the filter is actually working. Troubleshooting such code issues in the web application is sometimes very difficult since you can not always see what is happening. By duplicating the same process in the desktop database, you can sometimes learn what is wrong.

    Jerry

  3. #3
    Member René Stout's Avatar
    Real Name
    René Stout
    Join Date
    Oct 2003
    Location
    Tiendeveen, The Netherlands, Europe
    Posts
    529

    Default RE: filtering on session variable

    Jerry,

    I found it! After trying to follow your instructions and getting no results, I deleted the statement in the Advanced section of the grid and entered it in the a5w page (in the templ section). That worked...

    So, this cures the patient, but still I do not understand why it did not work in the grid, as I understand from the documentation that the Advanced section is designed to do just that what I wanted. Maybe I understand it wrongly.
    Thanks anyway for your advise.

    Greetz, René

Similar Threads

  1. Filtering dropdown by session variable
    By rhofrichter in forum Web Application Server v6
    Replies: 2
    Last Post: 10-12-2005, 08:32 AM
  2. Filtering a GridLinker using a Session Variable
    By Selwyn Rabins in forum Web Application Server v6
    Replies: 1
    Last Post: 06-23-2005, 03:17 PM
  3. saving a session variable in a link
    By Sarah Mengesha in forum Web Application Server v6
    Replies: 6
    Last Post: 12-01-2004, 06:09 PM
  4. Set session variable from grid selection
    By Pat Bremkamp in forum Web Application Server v6
    Replies: 2
    Last Post: 09-27-2004, 07:57 PM
  5. lookup on a WAS session variable
    By John Haytko in forum Web Application Server v6
    Replies: 2
    Last Post: 09-13-2004, 04:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •