Action Menus
You can customize the Actions menu in SaveToDB products.
Available Actions
The following actions are available across all SaveToDB products:
- Execute queries from tables and views
- Execute stored procedures
- Execute SQL commands
- Execute HTTP commands
The SaveToDB add-in also supports:
- Execute macros
- Execute Windows Shell and CMD commands
- Export worksheets
- Create PDF files
- Refresh data
- Select, hide, and show worksheets
For more details, check out Handler Types.
Adding Menu Items
To add menu items, create records with the Actions event type in the xls.handlers table.
Example
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE | TARGET_WORKSHEET | MENU_ORDER | EDIT_PARAMETERS |
---|---|---|---|---|---|---|---|---|---|---|---|
s04 | usp_order_form | Actions | s04 | xl_actions_items_print_as_html | PROCEDURE | 11 | |||||
s04 | usp_order_form | Actions | s04 | MenuSeparator40 | MENUSEPARATOR | 40 | |||||
s04 | usp_order_form | Actions | s04 | xl_actions_items_insert_item | PROCEDURE | _Reload | 41 |
This example shows two items separated by a menu separator.
Note: Menu separators must have names because the table uses a unique index that includes columns from TABLE_SCHEMA to HANDLER_NAME.
You can use translation features to define business names for menu items. See Translating Object Names.
Use integer values in the MENU_ORDER column to arrange items.
Pay attention to the _Reload value in the TARGET_WORKSHEET column. This value allows you to reload data after executing the handler. For more options, refer to Target Worksheet Values.
Another Example
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE | TARGET_WORKSHEET | MENU_ORDER | EDIT_PARAMETERS |
---|---|---|---|---|---|---|---|---|---|---|---|
s05 | usp_order_header | Actions | s05 | xl_actions_order_create | PROCEDURE | _reload | 11 | 0 | |||
s05 | usp_order_header | Actions | s05 | MenuSeparator30 | MENUSEPARATOR | 30 | |||||
s05 | usp_order_header | Actions | s05 | xl_actions_order_print | PROCEDURE | 31 | 0 | ||||
s05 | usp_order_header | Actions | s05 | Create Quote & Invoice PDF | quote,invoice | 32 | |||||
s05 | usp_order_header | Actions | s05 | Create Quote & Invoice XLSX | REPORT | quote,invoice | 33 |
This example also includes procedures. Note the zeros in the EDIT_PARAMETERS column, which suppress the dialog box for editing parameters.
The PDF and REPORT handlers specify lists of worksheets in the TARGET_WORKSHEET field for generating PDFs and exporting worksheets.
For more details, see Handler Types.
Context Parameters
Application menu handlers can access values of active query parameters and the following context parameters. Unlike context menu handlers, these handlers do not have an active row context.
Parameter Name | Value |
---|---|
@DataLanguage or @data_language | A data language code selected in the Options dialog box |
@TableName or @table_name | A qualified name of the active query object, e.g., [s02].[usp_cashbook] |
@WindowsUserName or @windows_user_name | The Windows login of the current user |