| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > QueryClass > QueryClass Methods >====== Ask (a virtual to accept query criteria) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[additem add field to query .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[clearquery remove loaded query .htm|{{btn_next_n.gif|Next page}}]] | | || **Ask( **[ //uselast //] **), VIRTUAL, PROC** {{blk2blue.jpg|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 add field to query .htm|AddItem]], [[getfilter return filter expression .htm|GetFilter]], [[ask solicit query criteria 1.htm|QueryFormClass.Ask]], [[queryformclass.htm|QueryFormClass]]