Context Menus
You can customize the context menu in your applications.
Here are the actions 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:
For more details, check out Handler Types.
To add menu items, create records with the ContextMenu 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 | ContextMenu | s04 | Google Search | HTTP | https://www.google.com/search?as_q={name} | 11 | ||||
s04 | usp_order_form | ContextMenu | s04 | MenuSeparator40 | MENUSEPARATOR | 40 | |||||
s04 | usp_order_form | ContextMenu | s04 | xl_actions_items_insert_item | PROCEDURE | _Reload | 41 | 1 | |||
s04 | usp_order_form | ContextMenu | s04 | xl_actions_items_delete_item | PROCEDURE | _Reload | 47 | 1 | |||
s04 | usp_order_form | ContextMenu | s04 | xl_actions_items_rename_item | PROCEDURE | _Reload | 49 | 1 |
This example includes two sections of items separated by a menu separator.
Menu separators must have unique names, as the table uses a unique index that spans from TABLE_SCHEMA to HANDLER_NAME.
You can leverage translation features to define business names for menu items. See Translating Object Names.
Use integer values in the MENU_ORDER column to control the order of items.
Note the _Reload value in the TARGET_WORKSHEET column. This value allows you to refresh data after executing the handler. For more options, refer to Target Worksheet Values.
Also, take note of the value 1
in the EDIT_PARAMETERS column. This value triggers the dialog box for editing parameters.
Context Parameters
Context menu handlers can access values from the active row, active query parameters, and the following context parameters:
Parameter Name | Value |
---|---|
@ColumnName or @column_name | The active column name |
@CellValue or @cell_value | The active cell's text value |
@CellNumberValue or @cell_number_value | The active cell's numeric value |
@CellDateTimeValue or @cell_datetime_value | The active cell's datetime value |
@DataLanguage or @data_language | A data language code selected in the Options dialog box |
@TableName or @table_name | The qualified name of the active query object, e.g., [s02].[usp_cashbook] |
@WindowsUserName or @windows_user_name | The Windows login of the current user |