Finding the right place to customize
To determine where to add code to make your customization, use Code Link or Code File properties or consider these questions.
Direct access with Code Links
The most common places to customize the generated code are accessible from Code
Link properties. Code Link properties provide direct access to
the
POINT in the appropriate generated file. For example, the Compute
Fields property on a Form record opens the correct generated
4gl file to the POINT location logically used for computing
fields.{<POINT Name="fct.recExample_computeFields.user">} {</POINT>}You will find Code Link properties available on:
Meta-schema - Select the background of the Meta-schema diagram.
- table
ConstraintsKey UniquenessKey ExistsSelectInsert (before)Insert (after)UpdateDeleteDelete (Concurrent)Cascade DeleteOptimistic LockingDefaults
- column
Constraints (Column)
Form
- Records tab
- ManagedForm - Select the background of the Form Records tab.
Open WindowUI AutomatonDisplay Mode EventsInput Mode EventsSearch Mode EventsEmpty Mode EventsAction State
- Record
Select rowsSelect rowComputed fieldsInsertUpdateDeleteDelete (Concurrent)Lookups (Descending)Combobox initializer (Data)Defaults (Dialog)DISPLAY attributesDISPLAY eventsINPUT eventsCONSTRUCT eventsAction stateField Activation
- Record field
Field Activation
- ManagedForm - Select the background of the Form Records tab.
- Form tab
- Combobox widget
Combobox initializer (Data)Combobox initializer (UI)
- Combobox widget
Direct access with Code Files
Code Files properties are available for direct access to the appropriate generated code file.
You will find Code Files properties available on:
Meta-schema - Select the background of the Meta-schema diagram.
Dataopens Schema_dbxdata.4glConstraintsopens Schema_dbxconstraints.4gl
UIopens Form_ui.4glDialogsopens Form_uidialog.4glDialog Dataopens Form_uidialogdata.4glDataopens Form_uidata.4gl
Manually finding the right location
If a Code Link is not available to help guide you to a location for your custom code, these questions can help you determine where to customize.
- Can the modification be done in a model?
- For example, can you make a change to a property on an entity in the BA diagram to get the desired effect? This is the best first choice because the models drive the code generation. When you rebuild, the generated code reflects your changes. See Modeling the application.
- Can the modification be done in an external resource file?
- For example, you can modify the default Toolbar file that is loaded by the program. Modifying an external resource file does not affect the code generation if you use the default naming convention (dbapp.4tb, for example). When you rebuild, the modified resource file is loaded instead of the default one. See Modify action defaults, Modify styles, Modify the Top Menu, Modify the Toolbar.
- Is the modification database related?
- Look at the functions in the Schema_dbxdata.4gl and Schema_dbxconstraints.4gl files. Look for a
POINTin the function to place your custom logic. If aPOINTis not available, modify theBLOCKof code. See Using POINTs and BLOCKs. - Is the modification for when the program begins or ends?
- Look at the
MAINfunction in the Program.4gl file. Look for aPOINTin the function to place your custom logic. If aPOINTis not available, modify theBLOCKof code. See Using POINTs and BLOCKs. - Is the modification related to the interaction with the user?
- Look at the functions in the Form_ui.4gl, Form_uidialog.4gl, Form_uidialogdata.4gl, and Form_uidata.4gl. Look for a
POINTin the function to place your custom logic. If aPOINTis not available, modify theBLOCKof code. See Using POINTs and BLOCKs. - Is the modification related to reporting?
- Look at the functions in the _report.4gl and
_reportdata.4gl files. Look for a
POINTin the function to place your custom logic. If aPOINTis not available, modify theBLOCKof code. See Using POINTs and BLOCKs. - Is the modification related to web services?
- Look at the functions in the _service.4gl and
_server.4gl, and _uidata.4gl files. Look for a
POINTin the function to place your custom logic. If aPOINTis not available, modify theBLOCKof code. See Using POINTs and BLOCKs. - Is the modification repeating many times?
- Consider modifying the template files. See BAM Template Developer Guide.