Customising a Query for Default lookup

It is possible to define our own query for the default lookup. We may even include multiple buffer fields in the lookup browse widget if it is defined in the query. Let us define a custom query for the Sales Rep lookup in the program.
For this you may select any desired program and follow the below steps, but for demo purposes we have used the program c/custmord.p.

  • Open the Query program from the menu: X/E-Files > Master Files> Query
  • Create a new query record for program c/custmord.p, with query name

-Here, SalesRep is the field name for Sales Rep.

Note: To use a custom query for any default lookup, the query name must be same as the field name, i.e. the query name for lookup field SalesRep(Customer Program) must be SalesRep(Query Program).

  • The figure below shows the creation of a query for the SalesRep lookup which only fetches the SalesRep records from regions ‘east’ or ‘west’ instead of all, based on the code in the Query clause.
Creating query for Lookup
Figure: Creating query for Lookup

Note: If we enter ‘*’ in the Program field instead of c/custmord.p, then the query can be used for default lookup in all the programs containing the field SalesRep.

  • Optionally, we can define which fields to display or not, in the lookup based on this query.
  • To do this, go to the tab Fields.
  • Create required records for fields to be displayed in the lookup as shown in figure below
Lookup fields for Customized lookup query
Figure: Lookup fields for Customized lookup query
  • Now, the lookup for Sales Rep will look like the one shown in the figure below
Default lookup displaying records from a customized query
Figure: Default lookup displaying records from a customized query

results matching ""

    No results matching ""