Understanding what gets generated

Several source module (.4gl) files are generated for each diagram entity.

The generated source module (.4gl) files for each diagram entity are shown in the Intermediate Files folders in the project. For example, Figure 1 shows the generated files for the Account.4prg program entity.

Figure: Intermediate Files

Screenshot of Intermediate Files in the OfficeStore project.

In addition, each entity also has an XML file listed in the Intermediate Files folder. This is a temporary file that consolidates data from the diagrams; it is used to generate the source module (.4gl) code. These files can be useful to a template developer, as they are input to the code that is generated. See How code is generated.

When a generated program is built, the generated source module (.4gl) files are compiled into p-code executable (.42m) and program (.42r) files, depending on the language selected. These compiled binary files are stored in the directory specified by the Target directory property of the group node. By default, this is the project's /bin directory; to change directories, change the value of the Target directory property.

The default template set is designed to generate organized and functional code for a data-driven business application. See The default template features.

Each generated 4gl file contains functions. Within each function are POINTs and BLOCKs where you can add your own code.
Important:

Code events are now the preferred method for adding customized code. Use of POINTs and BLOCKs is no longer recommended, unless you cannot find an appropriate code event. See Using code events for more details.

Code Files and Code Link Properties can be used to directly access generated files and specific POINTs.
Figure: Generated files for the default template

Generated files map.
Table 1. Generated files for the program entity
File Description
Program.4gl The Program.4gl file contains the custom code for the program.
Program_prg.4gl The Program_prg.4gl file contains the MAIN function. It defines connects to the data source using the CONNECT TO statement, loads styles and action defaults files, and performs some initialization tasks for the application.
Program_events.4gl The Program_events.4gl file defines the events and the callback function definitions for the program.
Table 2. Generated files for the database
File Description
Schema.4gl The Schema.4gl file contains the custom code for the database.
Schema_dbxdata.4gl The Schema_dbxdata.4gl file manages the database SELECT, INSERT, UPDATE, and DELETE statements.
Schema_dbxconstraints.4gl The Schema_dbxconstraints.4gl file manages table and column constraints.
Schema_events.4gl The Schema_events.4gl file defines the events and the callback function definitions for the database.
Schema_common.4gl The Schema_common.4gl file contains the model for the database.
Table 3. Generated files for form entities
File Description
Form.4gl The Form.4gl file contains the custom code for the form entity.
Form_ui.4gl The Form_ui.4gl file contains functions called from MAIN. It opens the form based on the open mode, loads the Toolbar and Topmenu, launches functions to manage application states, calls MENU or DIALOG statements for the various states and calls functions in the Form_uidialog.4gl to retrieve and manage subdialogs.
Form_uidialog.4gl The Form_uidialog.4gl file defines the subdialogs and modular variables. It manages the states of actions, fields and subdialog and calls functions in the Form_uidialogdata.4gl.
Form_uidialogdata.4gl The Form_uidialogdata.4gl file defines the modular variables, manages UI data (clear, fetch, set default values), and calls functions in the Form_uidata.4gl.
Form_uidata.4gl The Form_uidata.4gl file includes functions to retrieve and manage the database data. It defines the records for the database columns and tables; creates and fills a dynamic row of data; creates and fills a dynamic row of record keys; contains the SQL statements to INSERT, SELECT, UPDATE, and DELETE rows in the database; and handles the SQL transactions.
Form_events.4gl The Form_events.4gl file defines the events and the callback function definitions for the form entity.
Form_common.4gl The Form_common.4gl file contains the model for the form entity.
Important:

Reports and Web Services are not supported on mobile platforms.

Table 4. Generated files for the reports
File Description
Report.4gl This file contains the custom code for the report entity.
Report_report.4gl This file contains the report driver for the report.
Report_reportdata.4gl This file contains the SQL and BDL statements to fetch the report data.
Report_events.4gl This file defines the events and the callback function definitions for the report.
Report_common.4gl The Report_common.4gl file contains the model for the report entity.
reportdata_report.rdd This data file is generated for use when the developer creates the report definition file (4rp).
Table 5. Generated files for the web services
File Description
WebService.4gl This file contains the custom code for the Web Service entity.
WebService_service.4gl This file handles business record type definition (only take public fields), defines the module variables (input and output variable for service's CRUD operations), and sets up the service and publishes the CRUD operations.
WebService_serviceclient.4gl This file is the Client API of a JSON Web Service. It contains a set of function wrappers which allow communication with a JSON Web Server.

See Create a Genero BDL client for a JSON Web service for more information on using this file to create a JSON client.

WebService_uidata.4gl This file handles business record type definition, contains operations to insert / update / delete rows in the database, contains ascending lookup management.
WebServiceServer_server.4gl This file contains the MAIN function, sets up the web service engine, contains the CONNECT TO BDL statement, registers services, and listens for incoming requests.
WebService_events.4gl This file defines the events and the callback function definitions for the Web Service.
WebService_common.4gl The WebService_common.4gl file contains the model for the Web Service entity.
WebService.xml The XML file contains the information about the web service needed to generate the logic in the 4gl files.
WebServiceServer.xml This file contains the information about the Webservice Server needed to generate the logic in the 4gl files.
Table 6. Library files used by a generated app
File Description
libdbappCore.4gl This file includes common functions for managing errors and strings.
libdbappEvents.4gl This file includes constants, and types related to code events.
libdbappExt.4gl This file includes common functions for managing the interaction with mobile device peripherals. See Add mobile device features (Photo, Gallery, Phone, Mail, SMS, Contact, Maps, Barcode)
libdbappFormUI.4gl This file includes common functions related to form transitions and states.
libdbappSQL.4gl This file includes common functions related to SQL transactions, errors, and database statements.
libdbappUI.4gl This file includes common functions related to the user interface such as Topmenus, Toolbars, and front-end type.
libdbappReportCore.4gl This file includes common functions for managing reports.
libdbappReportUI.4gl This file includes common functions related to report transitions and states.
libdbappWSCore.4gl This file includes common functions for managing Web services and HTTP errors.
libdbappWS.4gl This file includes common functions for managing Web services HTTP requests and responses.
libdbappWSCIient.4gl This file includes common functions for managing URL access to the Web service server.
libdbappPrintSettings.4fd This form can be used for setting print settings.
libdbappFieldselectiondialog.4fd This form can be used for selecting fields to print.