Lycia LowCode Methods

Common information:

Calling a method from the InteractForm object:

Calling a method from the View:

Method Purpose
DoesTableRowExist() Used for querying the database about whether a row with a given primary key(s) value(s) exists
GetCurrentDialog() Returns the dialog object (ui.Dialog) of the InteractForm object
GetEventView() Returns the name of the view in which the event is currently running
GetEventSubInteraction() Returns the name of the sub-interaction in which the event is currently running
GetCurrentEvent() Returns the raw event name that was currently running
SaveChanges() Used to store changes in the database
Refresh() Used to reset data in the View
GetViewCurrentRecord() Used to get the current record data of the View
SetViewCurrentRecord() Used to modify the current record data of the View
GetViewArray() Used to get the array data of the View
SetViewArray() Used to set the array data of the View
SetEmbeddedData() Allows a LowCode data source View to use data of a variable (array of records) handled / managed by your 4GL code instead of a database table

Rules of Usage

DISPLAY ARRAY:

INPUT ARRAY:

Additional Information

DoesTableRowExist()

This method is created to query the database on whether a row with a given primary key(s) value(s) does exist. The function DoesTableRowExist() is available as a public function and as a method of the view object.

Syntax:

1. Standalone public function:

FUNCTION DoesTableRowExist(table STRING, keys DYNAMIC ARRAY OF STRING, vals REFERENCE) RETURNS BOOL

2. Method of the Views object:

FUNCTION (this VIEW) DoesTableRowExist(vals REFERENCE) RETURNS BOOL

 

Example code for a standalone public function:

#Query the table "state" if a row with a given set of primary key values exist.

LET hm["country"]= country

LET hm["state_code"]= state_code

 

#FUNCTION DoesTableRowExist(table STRING, keys DYNAMIC ARRAY OF STRING, vals REFERENCE) RETURNS BOOL

IF DoesTableRowExist("state", ["country,state_code"], hm) THEN

MESSAGE "Table row with the primary key values country and state_code does exist"

ELSE

ERROR "Table row with the primary key values country and state_code does not exist"

END IF

END FUNCTION

 

Example code for the Views method:

#Query the table "state" if a row with a given set of primary key values exist.

LET hm["country"]= country

LET hm["state_code"]= state_code

 

#FUNCTION (this VIEW) DoesTableRowExist(vals REFERENCE) RETURNS BOOL

IF iForm.views["state"].DoesTableRowExist(hm) THEN

MESSAGE "Table row with the primary key values country and state_code does exist"

ELSE

ERROR "Table row with the primary key values country and state_code does not exist"

END IF

END FUNCTION

 

 

Return to top

GetCurrentDialog()

The GetCurrentDialog() method is an instance method of the InteractForm and View objects:

# FUNCTION (this InteractForm) GetCurrentDialog() RETURNS Ui.Dialog

# FUNCTION (this View) GetCurrentDialog() RETURNS Ui.Dialog

Note: One instance of InteractForm can have one or many instances of View referenced / stored in the views Hashmap.

TYPE InteractForm RECORD #

form_file STRING # The form file that should be opened

, log_file STRING # The path to log file. It's optional property

, log_to_file BOOL # Indicates if error message should be logged to file

, translations HASHMAP OF STRING # Map of message/table/column translations

, views HASHMAP OF View # A set of views of tables that are depends each other

, custom VARIANT # The placeholder for any additional custom values that can be usefull to keep in object

END RECORD #

iForm.GetCurrentDialog() returns the dialog object (ui.Dialog) of the InteractForm object.

iForm.views["<table_name>"].GetCurrentDialog() returns the dialog object (ui.Dialog) of the specified View of an InteractForm object.

Example:

FUNCTION i_p_policy_actions_insert_after_field(iform InteractForm INOUT) RETURNS BOOL

DEFINE dlg ui.dialog

 

LET dlg = iForm.views["policy"].GetCurrentDialog()

LET field_id = dlg.getCurrentItem()

LET _rec_policy = iForm.views["policy"].GetViewCurrentRecord()

 

CASE dlg.getCurrentItem()

...

WHEN "policy.client_no"

IF _rec_policy.client_no < 1 OR _rec_policy.client_no IS NULL THEN

ERROR "Client Number can not be empty, 0 or negative"

CALL dlg.nextfield("+PREV")

END IF

...

END CASE

 

CALL iForm.views["policy"].SetViewCurrentRecord(iForm, _rec_policy)

RETURN FALSE

END FUNCTION

 

Return to top

GetEventView()

The public method GetEventView() returns the name of the view in which the event is currently running:

FUNCTION (this InteractForm) GetEventView() RETURNS STRING

 

Return to top

GetEventSubInteraction()

The public method GetEventSubInteraction() returns the name of the sub-interaction in which the event is currently running:

FUNCTION (this InteractForm) GetEventSubInteraction() RETURNS STRING

 

Return to top

GetCurrentEvent()

The method GetCurrentEvent() returns the raw event name that was currently running:

FUNCTION (this InteractForm) GetCurrentEvent() RETURNS STRING

 

Return to top

SaveChanges()

This method is used to store changes in the database (for the View object):

FUNCTION SaveChanges(iForm InteractForm INOUT)

 

Return to top

Refresh()

This method is used to reset the data in the View:

FUNCTION Refresh(iForm InteractForm INOUT, withQuestion BOOL) RETURNS BOOL

This method only works in the update mode (at the record modification, to revert the changes) or in the main interaction.

 

Return to top

GetViewCurrentRecord()

This method is used to get the current record data of the View:

GetViewCurrentRecord() RETURNS HASHMAP

 

Return to top

SetViewCurrentRecord()

This method is used to modify the current record data of the View:

SetViewCurrentRecord(iForm InteractForm INOUT, rec HASHMAP)

 

Return to top

GetViewArray()

This method is used to get the array data of the View:

GetViewArray() RETURNS DYNAMIC ARRAY OF HASHMAP

 

Return to top

SetViewArray()

This method is used to set the array data of the View:

SetViewArray(iForm InteractForm INOUT, arr DYNAMIC ARRAY OF HASHMAP)

Restrictions

 

Return to top

SetEmbeddedData()

This method allows a LowCode data source View to use data of a variable (array of records) handled / managed by your 4GL code instead of a database table.

It accepts the DYNAMIC ARRAY OF RECORD as the parameter:

CALL <settings_record>.views["<db_table_name>"].SetEmbeddedData(<array_name>)

The array members should have the same names as the form field Identifiers where the data will be displayed.

Example:

FUNCTION init_embedded_array_data()

LET _arr_rec_contact[1].cont_id = i

LET _arr_rec_contact[1].cont_fname = "Alex"

LET _arr_rec_contact[1].cont_lname = "Williams"

 

LET _arr_rec_contact[2].cont_id = i

LET _arr_rec_contact[2].cont_fname = "Angela"

LET _arr_rec_contact[2].cont_lname = "Hoelzl"

END FUNCTION

FUNCTION contact_activity_list(p_rec_settings InteractForm_Settings)

LET p_rec_settings.form_file = "../demo_contact_activity_embedded/contact_activity_list"

 

CALL init_embedded_array_data() #populate array record 'contact' with data

 

CALL p_rec_settings.views["contact"].SetEmbeddedData(_arr_rec_contact)

CALL InteractForm(p_rec_settings)

END FUNCTION

There are some specifics to this method's use:

 

Return to top

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.