User Tools

Site Tools


ask_a_virtual_to_accept_query_criteria_.htm
Navigation:  ABC Library Reference > QueryClass > QueryClass Methods >====== Ask (a virtual to accept query criteria) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

Ask( [ uselast ] ), VIRTUAL, PROC

blk2blue.jpg

Ask A virtual to accept query criteria (search values) from the end user.
uselast An integer constant, variable, EQUATE, or expression that determines whether the QueryClass object carries forward previous query criteria. A value of one (1 or True) carries forward input from the previous query; a value of zero (0 or False) discards previous input.

The Ask method is a virtual to display a query dialog, process its events, and return a value indicating whether to apply the query or abandon it. A return value of Level:Notify indicates the QueryClass object should apply the query criteria; a return value of Level:Benign indicates the end user cancelled the query input dialog and the QueryClass object should not apply the query criteria.

The GetFilter method generates filter expressions using the search values set by the Ask method.

Implementation:

For each item that can be queried (added by the AddItem method), the Ask method collects the query values from the selected item's file buffers rather than from a query input dialog. This default behavior automatically gives you query criteria (search values) for the current item without soliciting input from the end user. This allows you to, for example, use a regular update form as a special kind of query (QBE) form.

Return Data Type:     BYTE

Example:

MyQueryForm.Ask PROCEDURE(BYTE UseLast)         !derived class Ask method

W  WINDOW('Example values'),CENTER,SYSTEM,GRAY  !declare user input dialog

   BUTTON('&OK'),USE(?Ok,1000),DEFAULT

   BUTTON('Cancel'),USE(?Cancel,1001)

  END

CODE

OPEN(W)

IF ~UseLast THEN SELF.Reset().      !preserve or discard prior query

IF SELF.Win.Run()=RequestCancelled  !show dialog and handle events

 RETURN Level:Benign                !return Cancel indicator

ELSE

 RETURN Level:Notify                !return OK indicator

END

See Also:     AddItem, GetFilter, QueryFormClass.Ask, QueryFormClass

ask_a_virtual_to_accept_query_criteria_.htm.txt · Last modified: 2021/04/15 15:56 by 127.0.0.1