Record Edit Mode on DOUBLECLICK in DISPLAY ARRAY (List View)
Disabling the Built-In Actions
'actions_on_done': Arranging Custom Actions Execution After the Built-In Actions
Actions are defined for a particular view (global view or one particular table view) and an action / event scope by using one of the scope definitions shown below:
There are:
Note: Before proceeding, get acquainted with the Settings Levels section of LyciaLowCode Settings page (the concept of levels is essential for configuring multiple interactions and the multitable support).
The definitions like LET <setting_variable>.<setting_name> = <value> refer to the InteractForm_Settings level, while LET <setting_variable>.views["<db_table_name>"].<setting_name> = <value> refers to the View level.
This setting can be defined for:
InteractForm_Settings level: Yes
View level: Yes
Defining an action (custom) for any / all views:
Defining an action mapped only for a particular view (table name):
Example 1:
Example 2:
LET settings.actions[""]["BEFORE DISPLAY"] = FUNCTION custom_before_display
LET settings.actions[""]["ON ACTION Accept"] = FUNCTION table_view # Adding custom action
Example 3:
LET p_rec_settings.views["contact"].actions[""]["ON ACTION ContactOnly"] = FUNCTION ContactOnlyFunc
When the data is displayed in the form of alist (DISPLAY ARRAY, List View), double-clicking on any row will invoke another LyciaLowCode process that will offer the user to edit the corresponding row in a Detailed Record View:
FUNCTION settings_list()
DEFINE l_settings InteractForm_Settings
LET l_settings.form_file="../llc_settings/llc_settings_list"
LET l_settings.actions[""]["ON ACTION DOUBLECLICK"] = FUNCTION settings_rec_input
LET l_settings.actions[""]["BEFORE ROW"] = FUNCTION actions_set_m_pk
CALL InteractForm(l_settings)
END FUNCTION
Invoking the built-in action looks as follows:
When specifying a custom action, you must prefix the action identifier with the keywords ON ACTION.
Invoking a custom action:
Example:
On the top level, we will have an active custom action with the identifier "Hello":
Examples of the action / function reference mappings:
.actions["DIALOG"]["ON ACTION Hello"] = FUNCTION y
.actions["DIALOG"]["ON INSERT"] = FUNCTION z
.actions["INSERT"]["BEFORE INPUT"] = FUNCTION a
.actions["UPDATE"]["AFTER FIELD"] = FUNCTION b
.actions["ANY"]["AFTER INPUT"] = FUNCTION c
If you set the function call to NULL, this will disable the corresponding built-in action. See the examples below:
LET settings.actions[""]["ON INSERT"] = NULL # Hide the INSERT action
LET settings.actions[""]["ON APPEND"] = NULL # Hide the APPEND action
LET settings.actions[""]["ON DELETE"] = NULL # Hide the DELETE action
LET settings.actions[""]["ON UPDATE"] = NULL # Hide the UPDATE action
The actions_on_done setting triggers the execution of a custom action after the built-in action:
This setting can be defined for:
InteractForm_Settings level: Yes
View level: Yes
To trigger the action with a change event, provide the fields for the ON CHANGE clause. There are four available options:
For the function to be used as definition for the actions setting, and manage the built-in actions (or disable them), it must have one argument, receive the reference for current Lycia LowCode process record data (iform), and return the BOOLEAN status:
The function should return TRUE if it should prevent a built-in / predefined action processing, and it should return FALSE if it should not prevent built-in / predefined action.
Example:
FUNCTION custom_before_display(iform InteractForm INOUT) RETURNS BOOL
CALL fgl_winmessage("BEFORE DISPLAY")
RETURN FALSE # Process the custom action code first, and then the built-in action code.
END FUNCTION
With Lycia LowCode, you can attach function calls to SQL operations.
SQL Operation | LowCode's SQL Action Name |
BEGIN WORK | SQL BEGIN WORK |
COMMIT WORK | SQL COMMIT WORK |
ROLLBACK WORK | SQL ROLLBACK WORK |
UPDATE | SQL UPDATE |
INSERT | SQL INSERT |
DELETE | SQL DELETE |
Choosing between the actions or actions_on_done settings defines whether your associated function reference should be called before the SQL operation is processed or after it is completed.
Examples:
LET settings.actions ["ANY"]["SQL BEGIN WORK"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL BEGIN WORK"] = FUNCTION myFunc
LET settings.actions ["ANY"]["SQL COMMIT WORK"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL COMMIT WORK"] = FUNCTION myFunc
LET settings.actions ["ANY"]["SQL ROLLBACK WORK"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL ROLLBACK WORK"] = FUNCTION myFunc
LET settings.actions ["ANY"]["SQL UPDATE"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL UPDATE"] = FUNCTION myFunc
LET settings.actions ["ANY"]["SQL INSERT"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL INSERT"] = FUNCTION myFunc
LET settings.actions ["ANY"]["SQL DELETE"] = FUNCTION myFunc
LET settings.actions_on_done["ANY"]["SQL DELETE"] = FUNCTION myFunc