Adding Fields to a Program
To add fields to the newly created empty maintenance program Customer, we can use these approaches:
- Import fields from database (Bulk import)
- Drag and drop the widget and link it to the database table and field.
- Drag and drop the widget and use it locally (without associating it to database filed)
1.To Import fields from database in bulk, follow the following steps:
- Open 'X/E-Files > XE Developer Studio', and click on the Program in the left panel and select a desired program. Here we select 'c/custmord.p'.
- The program will be displayed on the screen editor automatically. The screen would appear empty as there are no fields added in it yet.
- Now, click on the 'Insert fields from database' icon present in the toolbar of the screen editor.
- 'Import Fields' window will pop up on the screen.

- From ‘Import Fields’ window, select Table and Fields which are required to be used in the maintenance program.
- Now, Click ‘OK’ button. All the selected fields would appear on the Screen editor, as shown in the figure below.

- After the fields/ widgets are added to the screen, it is possible to rearrange them by just dragging and dropping to the desired location. Click on ‘Commit‘ button to save your changes.

- After selecting the database table and importing the fields, you will see the query ‘Customer’ added automatically for your program as ‘Main query’ which retrieves all the records of Cutomer from Customer table by default. You can also customize the query by updating the ‘Query clause’.

- Now run your program by clicking either the Run button or My_Menu > Customer. You will now see the Customer records.

2.Drag and drop the widget and link it to the database table and field.
- Drag any widget from the widget panel and drop it on the screen editor. For instance, lets add a text-box for Customer’s EmailAddress.

Give the widget details as below after dropping it on the screen editor:
Widget-Name: <Field name of the table to which you want to link it> e.g. EmailAddress
File : <Name of database table> e.g. Customer
You can check/uncheck other attributes as per your requirement.Click ok and commit.
- Find the Widget Label Properties on right panel under Widgets tab and make the Label and Def.label field checked.
- Reload the workspace and open My_Menu > Customer program, you will find EmailAddress field added on your program.

3.Drag and drop the widget and use it locally (without associating it to database field)
The widgets that can be added by a drag and drop method and are not associated with any database field are local widgets. Such widgets can be used in the program locally whenever required.