AddItem (add field to query) 

Top  Previous  Next

 

AddItem( name, title [ ,picture ] )

AddItem

Adds specific functionality to the QueryClass.

name

A string constant, variable, EQUATE, or expression containing the queryable item, typically the fully qualified name of a field in the view being queried.

Tip: This may also be an expression such as UPPER(field1) or field1 * field2.

title

A string constant, variable, EQUATE, or expression containing the text to associate with the queryable item. This text appears as the prompt or header for the item in the query dialog presented to the end user.

picture

A string constant, variable, EQUATE, or expression containing the display picture for the queryable item. If omitted, picture defaults to S255 (unformatted string). See Picture Tokens in the Language Reference for more information.

The AddItem method adds a queryable item to the QueryClass object. The QueryClass object can then accept input for the item from the end user and build a filter expression to apply to the view being queried.

Other QueryClass methods, such as GetLimit and SetLimit, refer to the queryable item by its name.

 

You may use the BrowseClass.UpdateQuery method in combination with the AddItem method to define a query interface that contains the BrowseClass fields plus other queryable items.

Example:

QueryForm  QueryFormClass

QueryVis   QueryFormVisual

BRW1     CLASS(BrowseClass)

Q         &CusQ

        END

 

CusWindow.Init PROCEDURE()

 CODE

!open files, views, window, etc.

 BRW1.UpdateQuery(QueryForm)                    !add browse fields to query

 QueryForm.AddItem('UPPER(CUS:NAME)','Name')    !add caseless name to query

 QueryForm.AddItem('CUS:ZIP_CODE','Name')       !add zip code to query

 QueryForm.AddItem('ITM:Qty+ITM:Price','Total') !add dynamic total to query

END

RETURN Level:Benign

See Also:     BrowseClass.UpdateQuery