Fill combo-box by using query
In Javra IDE, for a maintenance program there will always be a main query and few other widget associated queries. The main query will always be there for the selected table using which the maintenance program is created. The list of queries available in a program can be viewed by clicking on the Query tab available in the right panel/ properties section of the XE Developer Studio.
You can see that the query Customer as a main query, as it is the Customer table that is being used in the program.
You can follow below steps to create a new query to fill the combo-box for the program you have created:
- First give Query, Type init, List-item value, List-item-pairs value for the field of type ‘COMBO-BOX‘, here we are using ‘State‘ field for demonstration propose.
- Press New button in the Query tab.
- In the Query* field, type the name of the query same as the name given in the advanced widget properties in the Widgets tab.
- Uncheck Main query checkbox, if already checked as there can be only one main query in a program.
- In File in Query, enter the table name(s) to be used in the query. Multiple table names are separated by a ‘,’ (comma).
- Keep on pressing the TAB key until a Query statement is generated in the Query clause A Query statement is generated only if the Query clause field is previously empty. The generated query statement can be modified manually as required.
- You can check the syntax by clicking on the Now button.
Save the query.
Now run the program, you will see the state field as type ‘combo’ filled with state abbreviation and state name, but the value will be taken as state only. Click on New, Copy or Update icon and then click on State field, you will see the field populated as shown in figure below.
Note:-
1)A query is associated only with combo boxes, look ups, selection tab types of widgets, but not with Fill-In or Checkbox widget types.
2)The Query Clause field should never be empty for any query.