Refreshing Dependent Lists

Refreshing Dependent Lists

Suppose we have the following configuration:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 s02usp_cashbookcompany_idValidationLists02companiesTABLEid, +name
 s02usp_cashbookcompany_idParameterValuess02companiesTABLEid, +name

In the sample, both the company_id column and parameter have values from the companies table.

If someone adds or edits companies, users with the opened usp_cashbook have to reload data and configuration or validation lists to get the new values.

SaveToDB 10 has an improved solution if a user updates source tables in the same workbook.

For example, if a user saves changes to the companies table, the add-in automatically refreshes company lists for columns and parameters.

The case above is simple as the lists are loaded from the table that is updated.

Suppose we have the following configuration, replacing the companies table with a procedure that selects values from the table:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 s02usp_cashbookcompany_idValidationLists02xl_list_company_idPROCEDURE
 s02usp_cashbookcompany_idParameterValuess02xl_list_company_idPROCEDURE

Even in this case, the add-in will refresh lists automatically if it can parse the procedure definition and find that the procedure selects data from the table.

However, you can point the dependency explicitly using the DependsOn event name.

For example:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 s02usp_cashbookcompany_idDependsOns02companiesTABLE

This way is simple as you can copy a line and change ValidationList to DependsOn.

However, it requires duplicated lines for every object and column.

You have an alternative way:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 s02xl_list_company_idDependsOns02companiesTABLE

This configuration tells that the list procedure depends on the companies table.

So, the add-in will update all lists based on xl_list_company_id when the companies table has been saved.

Moreover, you can set the dependency between edit forms and underlying tables.

For example, let's add a usp_companies procedure used to edit companies and set the dependency:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 s02usp_companiesDependsOns02companiesTABLE

In this case, when a user saves changes for the usp_companies procedure, the add-in will update lists based on the companies table and the xl_list_company_id procedure.