NetTalk Central

Author Topic: Filters again  (Read 3566 times)


  • Newbie
  • *
  • Posts: 17
    • View Profile
    • IRIS Systems
    • Email
Filters again
« on: June 19, 2007, 11:17:03 AM »
This is Steve Ellis again and I'm still having filter problems. I've got the following coded:


where the GLO is a global variable and the TRI8 one is in the file I'm browsing. I showed the GLO one as a subheading and it's valid for the file but I keep getting no records. I've even made the fields hot fields but nothing. I had it working at one point but the app got clobbered (GPF trying to read the app) so this is my second time coding. All I want to do is filter out records for a particular customer.


John Hickey

  • Administrator
  • Newbie
  • *****
  • Posts: 47
    • View Profile
    • Email
Re: Filters again
« Reply #1 on: June 19, 2007, 01:01:44 PM »
Sounds like there may be no value in GLO:CustCode being set.  Is GLO:CustCode being set in a different procedure, then calling the browse procedure?  Is the global variable threaded by chance (maybe it is on a different thread when you go to use it?).

Bruce cautioned me about using global variables, rather he recommended using p_web.SetSessionValue and p_web.GetSessionValue, or p_web.SetValue and p_web.GetValue.

If you are passing between procedures, the value for glo:CustCode might be passed to it already.  Check and see if p_web.GetValue('GLO:CustCode') or p_web.GetSessionValue('GLO:CustCode') return the right filter value.  Hopefully it does, and you can use that in your filter.


  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10772
    • View Profile
Re: Filters again
« Reply #2 on: June 19, 2007, 11:46:08 PM »
Hi Steve,

Firstly, global variables are a serious no-no. remember the web server application is being shared by many users at the same time, so the global variables are being shared by them all as well.

If your global variable is THREADed then it'll basically be blank all the time because everything happens on it's own thread. (even various routines in the same procedure, which also makes locals somewhat useless). If the globals are not THREADed then you will quickly encounter contention issues which will result in weird behavior.

So what you need to use are Session variables. Set them wherever you want to, and use them wherever you want to. They "belong" to one user. So you can treat them as "globals" but they belong to just one user.

For a filter, the classic construction looks like this

'TRI8:CustomerCode=' & p_web.GetSessionValue('GLO:CustCode')

IF Customercode is a numeric. IF it's a string then it looks like this

'TRI8:CustomerCode= <39>' & p_web.GetSessionValue('GLO:CustCode') &'<39>'

(all on one line)

Presumably elsewhere in your app (maybe on a web form, or in hand-code) Glo:CustCode has been set to something.