Overview of Lycia LowCode Settings
Settings Levels: 'InteractForm_Settings' and 'View'
The ‘InteractForm_Settings’ Record
Defining Lycia LowCode Settings
Defining Settings in .4gl File
Lycia LowCode has two records, InteractForm_Settings and View, to define data needed for the library's interaction with your programs. This data should be set before starting the interaction and cannot be changed during execution.
The InteractForm_Settings record stores settings used for the entire program. However, you will need the Views record settings to specify the screen record even if there's only one interaction.
Here's the list of settings you can configure using this record:
TYPE InteractForm_Settings RECORD #
form_file STRING # The form file that should be opened
, id STRING # Optional, a form file can contain multiple InteractForm settings, and it can be selected by 'id'
, log_file STRING # The path to log file. It's optional property.
, translations HASHMAP OF STRING # Map of message/table/column translations
, views HASHMAP OF View # The mapping of database table name and a its matching settings in the specific interaction.
, actions HASHMAP OF HASHMAP # Custom actions "SubIntercation - Action - Function", which will be added to the subdialog of defined table view and executed before LLC build-in event executing.
, actions_on_done HASHMAP OF HASHMAP # Custom actions "SubIntercation - Action - Function", which will be added to the subdialog of defined table view and executed after LLC build-in event executing.
, view_attributes HASHMAP OF HASHMAP # Custom attributes "SubIntercation - Attribute - Value", which will be applied to Dialog.
, paged_mode INT # If positive then buffer should be used (in this case it will take less time for starting interaction). This is the default value for all views that do not have a specified value.
, input_mode INT # If negative or 0 then DISPLAY ARRAY should be used, otherwise (positive) INPUT ARRAY is used. This is the default value for all views that do not have a specified value.
, pessimistic_locking INT # Pessimistic row locking is disabled by default (optimistic does not lock table during input, but only for the time of the actual db update). This is the default value for all views that do not have a specified value.
, confirm_accept INT # If positive then it shows a message box for yes/no/cancel when data has been changed AND the user presses ACCEPT. The default is negative (-1). This is the default value for all views that do not have a specified value.
, confirm_cancel INT # If positive then it shows a message box for yes/no/cancel when data has been changed AND the user presses CANCEL. The default is positive (1). This is the default value for all views that do not have a specified value.
END RECORD
For this level, configuring the log_file setting in 4GL will look like this:
l_rec_settings is the variable for LowCode settings, which you must define before configuring specific settings. Read about the full Lycia LowCode workflow in the Defining Lycia LowCode Settings section of this page.
The settings from the View record are used to customize a certain interaction with a certain database table. Each program has at least one View (interaction with a table), but with two or more Views you can define several collection of settings to configure different interactions. If the setting has not been defined on the View level, Lycia LowCode will use the definition on the InteractForm_Settings level.
To use multiple database tables for your program, configure multiple Views. The settings of the View are the following:
TYPE View RECORD #
screen_record STRING # The screen record name in the form that should be used. It's mandatory property.
, actions HASHMAP OF HASHMAP # Custom actions "SubInteraction - Action - Function", which will be added to the subdialog of defined table view and executed before LLC build-in event executing.
, actions_on_done HASHMAP OF HASHMAP # Custom actions "SubInteraction - Action - Function", which will be added to the subdialog of defined table view and executed after LLC build-in event executing.
, view_attributes HASHMAP OF HASHMAP # Custom attributes "SubInteraction - Attribute - Value", which will be applied to the subdialog of defined table view.
, not_update_fields DYNAMIC ARRAY OF STRING # The list of field which should not be activated on the Edit action
, paged_mode INT # If positive, then buffer will be used (in this case it will take less time for starting interaction)
, input_mode INT # If negative or 0, then DISPLAY ARRAY will be used; if any positive value, INPUT ARRAY will be used
, pessimistic_locking INT # Pessimistic row locking is disabled by default (optimistic does not lock table during input, but only for the time of the actual db update)
, sql_where_search STRING # The WHERE clause of the main query that can be overwritten as soon the user applies a Search (Construct)
, sql_where STRING # The WHERE clause of the main query that can NOT be overwritten by user
, sql_order_by STRING # The ORDER BY clause for the main query
, sql_top INT # The option to limit the base cursor row using the SQL SELECT TOP clause
, confirm_accept INT # If positive then it shows a message box for yes/no/cancel when data has been changed AND the user presses ACCEPT. The default is negative (-1)
, confirm_cancel INT # If positive then it shows a message box for yes/no/cancel when data has been changed AND the user presses CANCEL. The default is positive (1)
, comboboxes HASHMAP OF Combobox # Map of combobox field names and its sql where clause and dependencies
, lookups HASHMAP OF STRING # Map of lookup field names and its 'match' string that will be used in SQL WHERE clause
, zooms HASHMAP OF Zoom # Map of functionfield names and definitions of form for selecting value
, navigation_status STRING # Target location for the DISPLAY of navigation status (which can be a label or a textField)
END RECORD
For this level, configuring the log_file setting for a certain View in 4GL will look like this:
l_rec_settings here is the variable for LowCode settings, which you must define before configuring specific settings. Read about the full Lycia LowCode workflow in the Defining Lycia LowCode Settings section of this page.
You can define Lycia LowCode settings in the following ways:
The id is an identifier for the specific group of settings stored inside the views values array. You can define several groups of settings in the .fm2 form file or .4gl file, with different ids, and specify what settings the program must use at which interaction. This way, you can reuse the same form for different purposes.
Step 1. Link the Lycia LowCode library lib_llc_interact_form/llc_interact_form.4gl in your project:
Step 2. Call one of the following functions:
# 3 ways of invoking LowCode:
# PUBLIC FUNCTION InteractFormFile(formFile STRING)
# PUBLIC FUNCTION InteractFormFileWithSettings(form_file STRING, setting_id STRING)
# PUBLIC FUNCTION InteractForm(settings InteractForm_Settings)
Step 3. Create a function with Lycia LowCode settings and assign the values, like in the example below:
FUNCTION db_cms_virtual_field_rec()
DEFINE l_rec_settings InteractForm_Settings
LET md_log_console = NULL #clear console screen variable
LET l_rec_settings.form_file = "../misc/misc_virtual_field_rec"
LET l_rec_settings.id = "virtual_field"
LET l_rec_settings.log_file = "../log/db_cms_virtual_field.log" #enable log file
LET l_rec_settings.actions[""]["ON ACTION Show Data"] = FUNCTION math_on_action_show_data
LET l_rec_settings.actions[""]["AFTER ROW"] = FUNCTION math_on_action_show_data
LET l_rec_settings.actions["UPDATE"]["AFTER INPUT"] = FUNCTION math_after_input
LET l_rec_settings.actions["INSERT"]["AFTER INPUT"] = FUNCTION math_after_input
LET l_rec_settings.views["test03"].navigation_status="nav_page_of"
Note: For defining settings to control all the interactions of a program, use the following format:
LET <settings_variable>.<setting_name> = <setting_value>.
For defining settings for the interaction with the specific database table, use the following format:
LET <settings_variable>.views["<db_table_name>"].<setting_name> = <setting_value>.
Step 1. Although the settings themselves can be set in a form file, you need to link Lycia LowCode library in your .4gl file before defining specific settings:
Step 2. In .fm2 form file, create a JSON record that will specify the settings of a main level by the following structure:
<form xmlns="http://namespaces.querix.com/2015/fglForms"
interactSettings='
[
{
"<setting_1_name>":<setting_1_value>,
"<setting_2_name>":<setting_2_value>,
...
"<setting_n_name>":<setting_n_value>
}
]'>
If your form needs several Views, assign an id for each of such Views and put the settings for a specific View into the array as a value for the views key.
For example, the program demo_contact_activity is supposed to have three Views. Hence, the .fm2 form file for this program will have three arrays of View settings inside a main JSON array:
<form xmlns="http://namespaces.querix.com/2015/fglForms"
interactSettings='
[
{
"id": "Contact - Activity",
"views": {
"contact" : {
"screen_record": "scr_contact"
},
"activity" : {
"sql_where": "activity.contact_id = contact.cont_id",
"screen_record": "scr_activity"
}
}
},
{
"id": "Contact Only",
"views": {
"contact" : {
"screen_record": "scr_contact"
}
}
},
{
"id": "Activity Only",
"views": {
"activity" : {
"screen_record": "scr_activity"
}
}
}
]'>
Setting | Data Type | Description | If Default (If Not Set) | Can be set on InteractForm_Settings Level | Can be Set for a View |
form_file | STRING | Defines path to the form file that should be opened and used for interaction. If you use the InteractCurrentForm() function, the form_file setting will be ignored. | If this is not set, Lycia will use the currently opened / focused form. | Yes | |
id | STRING |
If the form has more than one collection of settings (View), id is the identifier for a certain collection. You can define the id with the value “ “ (one blank symbol) to prevent Lycia LowCode from merging settings from the form file, Lycia LowCode will ignore settings in the form file. |
If the id property is not defined in .4gl file, Lycia LowCode will merge settings with the first setting from the form file (if it exists). | Yes | |
log_file | STRING | Enables the errors output to the log file in addition to the on-screen output, and contains the path to the error log file. | If this is not set, the errors will be displayed on the screen only. |
Yes |
|
translations | HASHMAP OF STRING | This setting is a map of message / table / column translations. | Yes | ||
views | HASHMAP of View | This setting is the mapping for settings for interaction with the specific database table. At usage, it has to reference the name of the database table. | If the form file doesn’t have definition of the property interactSettings, then qxcompat tool will implicitly add this property during the compilation of the form file. |
Yes |
|
actions | HASHMAP OF HASHMAP | Defines a list of custom actions that should be added to the interaction. | Yes | Yes | |
actions_on_done | HASHMAP OF HASHMAP | Custom actions "SubInteraction - Action - Function", which will be added to the subdialog of the defined View (or the whole program if there is only one View in the program), and will be executed after Lycia LowCode executes the built-in events. | Yes | Yes | |
view_attributes | HASHMAP OF HASHMAP | Defines a list of custom attributes that should be applied to the main dialog or to the subinteraction. You can use any of the DIALOG, INPUT, DISPLAY ARRAY, INPUT ARRAY or CONSTRUCT attribute clauses. | Yes | Yes | |
paged_mode | INT | Activates the paged / buffered mode of the on-screen output (in this case it will take less time to start the interaction). If set to 1, then DISPLAY ARRAY or INPUT ARRAY will be in paged / buffered mode and will use the ON BUFFER block. | If this is not set, the entire table data will be loaded at the program runtime. | Yes | Yes |
input_mode | INT | If set to 1, adds the INPUT ARRAY interaction. | By default, Lycia LowCode makes DISPLAY ARRAY interaction with Insert, Update, and Delete actions. | Yes | Yes |
pessimistic_locking | INT | If set to any positive integer, will enable processing the database row updates using pessimistic row locking. | If this is not set, Lycia LowCode will use optimistic row locking. | Yes | Yes |
confirm_accept | INT | If set to positive integer, adds the Accept changes confirmation dialog box the program will display after the user clicks the Accept button during INPUT. It is a Button dialog box, asking to confirm the changes (Save / Cancel / Continue actions). | This dialog box is disabled by default (default value is 0). Set to 1 or any other positive value to enable. | Yes | Yes |
confirm_cancel | INT | If set to positive integer, adds the Cancel changes confirmation dialog box the program will display after the user clicks the Cancel button during INPUT. It is a Button dialog box, asking to confirm the changes (Save / Cancel / Continue actions). | This dialog box is enabled by default (default value is 1). Set to -1 or other negative value to disable. | Yes | Yes |
screen_record | STRING | Mandatory property. Defines the screen record that should be used for interaction. It should be defined in .4gl file or in the .fm2 form file. After merging 4gl-defined and form file-defined settings at runtime, Lycia LowCode should have this property, otherwise it will raise an error. | If this is not set, Lycia LowCode will search for the screen record with the $primary$ prefix (if you had one), use that screen record for interaction, and add the interactSettings property implicitly with the appropriate view definition. | Yes | |
not_update_fields | DYNAMIC ARRAY OF STRING | Defines the list of fields that should not be activated on user clicking the built-in Edit toolbar button. | Yes | ||
sql_where_search | STRING | Defines a WHERE clause that will be used from the beginning. Can be modified at runtime with clicking the Filter button on the toolbar. | If this is not set, data filtering is managed by database settings. | Yes | |
sql_where | STRING | Defines aWHERE clause of the main query that can not be overwritten by the user at runtime. sql_where is concatenated with sql_where_search; can’t be modified by the program user. | If this is not set, data filtering is managed by database settings. | Yes | |
sql_order_by | STRING | Sorts data in ascending or descending order (using ORDER BY). | If this is not set, data sorting is managed by database settings. | Yes | |
sql_top | INT | Defines the number of rows to limit the on-screen output using the SQL SELECT TOP clause (supported databases: Informix, MS SQL Server, Oracle and MySQL). | If this is not set, the entire table data will be loaded at the program runtime. | Yes | |
comboboxes | HASHMAP OF Combobox | This setting is a map of field names and their ComboBox widgets, SQL queries, and SQL WHERE clause. For details please see the full reference page. | Yes | ||
lookups | HASHMAP OF STRING | It’s a map of field names and their SQL WHERE clause. | Yes | ||
navigation_status | STRING | Displays the program user's location in the table (table row number used in the interaction) in relation to the total table row number. | Yes | ||
zooms | HASHMAP OF Zoom | This is a map of function field names and definitions of form for selecting the value. | Yes |
Lycia LowCode uses the dynamic DIALOG clause, which by default works UNBUFFERED and WITHOUT DEFAULTS.
You can override that behaviour. To do that, use the view_attributes setting:
DEFINE l_settings InteractForm_Settings # defining a variable for LowCode interaction
LET l_settings.view_attributes[""]["UNBUFFERED"] = FALSE
LET l_settings.view_attributes[""]["WITHOUT DEFAULTS"] = FALSE