Refreshing Dependent Lists
Let's consider the following configuration:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | usp_cashbook | company_id | ValidationList | s02 | companies | TABLE | id, +name | |
s02 | usp_cashbook | company_id | ParameterValues | s02 | companies | TABLE | id, +name |
In this example, both the company_id
column and parameter pull values from the companies
table.
When a user adds or edits entries in the companies
table, anyone with the usp_cashbook
open must reload data and configuration or validation lists to see the updated values.
SaveToDB 10 offers a better solution: if a user updates source tables within the same workbook, the add-in automatically refreshes company lists for columns and parameters.
This scenario is straightforward since the lists are directly loaded from the updated table.
Now, consider this configuration where we replace the companies
table with a procedure that selects values from it:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | usp_cashbook | company_id | ValidationList | s02 | xl_list_company_id | PROCEDURE | ||
s02 | usp_cashbook | company_id | ParameterValues | s02 | xl_list_company_id | PROCEDURE |
In this case, the add-in will still refresh lists automatically if it can parse the procedure definition and determine that it selects data from the table.
You can also explicitly define dependencies using the DependsOn event name.
For example:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | usp_cashbook | company_id | DependsOn | s02 | companies | TABLE |
This approach is simple; you can copy a line and change ValidationList
to DependsOn
.
However, it requires duplicating lines for every object and column.
An alternative configuration is:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | xl_list_company_id | DependsOn | s02 | companies | TABLE |
This configuration indicates that the list procedure depends on the companies
table. Thus, the add-in will update all lists based on xl_list_company_id
when the companies
table is saved.
Additionally, you can establish dependencies between edit forms and their underlying tables.
For instance, consider adding a usp_companies
procedure used to edit companies and setting the dependency:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | usp_companies | DependsOn | s02 | companies | TABLE |
In this case, when a user saves changes to the usp_companies
procedure, the add-in will update lists based on both the companies
table and the xl_list_company_id
procedure.