` Printed Icetips Article

Icetips Article



Par2: Alternate QBE interface
1998-12-08 -- Dan Presnell
 
If you don't like the default query form thrown on the screen by the ABC
templates, here's how you can do your own.

First, in the browse, define a string variable to hold the filter.

Next, put a button on the browse window to call the query form.  Call
the query procedure like this:

   myquery(filterstring)

In the brw1.applyfilter method, before the parent call, put this:

  brw1.setfilter(filterstring, 'ZZZZ')


Now create a window procedure for your query form.  Define threaded
variables there to hold the user's input.  In my case, these variables
would be this:

custname  string(30)
address   string(30)

In the data section of the query form procedure, define an object:

q queryclass

In the embed for the "ok" button, on accepted, before generated code,
put something like this:

q.init
q.additem('upper(cus:name)', 'Customer Name')
q.additem('upper(cus:address)', 'Address')
q.setlimit('upper(cus:name)',,, clip(left(upper(customername))))
q.setlimit('upper(cus:address)',,, clip(left(upper(address))))
query=q.getfilter()
q.kill

In the query form procedure, be sure to prototype it as (*string) and
make the parameter (query).

The advantage of this is that you can be more flexible in your query
forms.  Also, the browse procedure can test the filterstring variable to
see if a filter is in effect, and you can put a check-mark or other
visual warning to the user there.

Be sure you correct the bug in the ABQUERY.CLW file as described in
another post of mine.



Printed May 8, 2024, 1:17 am
This article has been viewed/printed 35112 times.