Adding Fields to a Program

To add fields to the newly created empty maintenance program Customer, we can use these approaches:

  1. Import fields from database (Bulk import)
  2. Drag and drop the widget and link it to the database table and field.
  3. 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.
Insert Fields Window (Numbers 1,2,3,4&5 follow the order of action)
Figure: Insert Fields Window (Numbers 1,2,3,4&5 follow the order of action)
  • 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.
Fields added to the Screen Editor
Figure: Fields added to the Screen Editor
  • 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.
Customised view of the Figure
Figure: Customised view of the Figure
  • 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’.
Button for running the program(left) and query generated for program (right)
Figure: Button for running the program(left) and query generated for program (right)
  • Now run your program by clicking either the Run button or My_Menu > Customer. You will now see the Customer records.
Program run after arranging the widgets
Figure: Program run after arranging the widgets

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.
Adding a widget by drag and drop and linking it to table
Figure: Adding a widget by drag and drop and linking it to table

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.
Added widget on program
Figure: Added widget on 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.

results matching ""

    No results matching ""