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
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>")
...
"comboboxes": {
"tbl1.tbl1_fk = tbl2.tbl2_pk":
{
"show_columns": [
"tbl2.tbl2_col1"
]
}
}
...
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