'comboboxes': Filtering Using the ComboBox

'comboboxes' Setting Overview

Populating the ComboBox in .4gl File

Populating the ComboBox In .fm2 Form File

Populating the ComboBox at Runtime

'comboboxes' Setting Overview

comboboxes is a map of field names and their SQL WHERE clauses. It is an optional property.

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: No

View level: Yes

 

Return to top

Populating the ComboBox in .4gl File

To define static WHERE clause for filtering ComboBox values, define the relationship between a Primary Key of one table and a Foreign Key of the other, and add a filtering condition if needed:

LET settings.views["<tbl1>"].comboBoxes["<tbl1.tbl1_fk> = <tbl2.tbl2_pk>"].sql_where = "<tbl2.tbl2_pk> BETWEEN 'A' AND 'E'"

CALL settings.views["<tbl1>"].comboBoxes["<tbl1.tbl1_fk> = <tbl2.tbl2_pk>"].show_columns.append("<tbl2_col1>")

 

Return to top

Populating the ComboBox In .fm2 Form File

...

"comboboxes": {

"tbl1.tbl1_fk = tbl2.tbl2_pk":

{

"show_columns": [

"tbl2.tbl2_col1"

]

}

}

...

 

Return to top

Populating the ComboBox at Runtime

If you need to control the ComboBox population based with conditions which are not just based on form fields, Lycia LowCode provides the public method PopulateComboBoxWhere(field STRING, where STRING) in the InteractForm object.

Example:

LET settings.actions["UPDATE"]["BEFORE FIELD state_code"] = FUNCTION before_field_state_code

...

FUNCTION(iform InteractForm INOUT) RETURNS BOOL

CALL iform.PopulateComboBoxWhere("activity.state_code", "state.country_code = 38")

RETURN TRUE

END FUNCTION

Note: For more information on ComboBox population, please refer here: Lookup Fields | Function Call

 

Return to top

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.