Context Menus

Context Menus

Developers can customize the context menu.

Here are actions available in all SaveToDB products:

  • Executing queries from tables and views
  • Executing stored procedures
  • Executing SQL commands
  • Executing HTTP commands

The SaveToDB add-in additionally supports:

See more details at Handler Types.

To add menu items, use records with the ContextMenu event type in the xls.handlers table.

For example:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODETARGET_WORKSHEETMENU_ORDEREDIT_PARAMETERS
 s04usp_order_formContextMenus04Google SearchHTTPhttps://www.google.com/search?as_q={name}11
 s04usp_order_formContextMenus04MenuSeparator40MENUSEPARATOR40
 s04usp_order_formContextMenus04xl_actions_items_insert_itemPROCEDURE_Reload411
 s04usp_order_formContextMenus04xl_actions_items_delete_itemPROCEDURE_Reload471
 s04usp_order_formContextMenus04xl_actions_items_rename_itemPROCEDURE_Reload491

This sample has two item sections separated by a menu separator.

Menu separators must have names, as the table has a unique index that includes columns from TABLE_SCHEMA to HANDLER_NAME.

You can use the translation features to define business names for menu items. See Translating Object Names.

Use integer values in the MENU_ORDER column to order items.

Pay attention to the _Reload value in the TARGET_WORKSHEET column.

You can use it to reload data after executing the handler. See more options at Target Worksheet Values.

Pay attention to 1 in the EDIT_PARAMETERS column. You can use this to run the dialog box used to edit parameters.

Context Parameters

Context menu handlers can use values from the active row, values of the active query parameters, and the following context parameters:

Parameter NameValue
@ColumnName or @column_nameThe active column name
@CellValue or @cell_valueThe active cell text value
@CellNumberValue or @cell_number_valueThe active cell number value
@CellDateTimeValue or @cell_datetime_valueThe active cell datetime value
@DataLanguage or @data_languageA data language code selected using the Options dialog box
@TableName or @table_nameA qualified name of the active query object like [s02].[usp_cashbook]
@WindowsUserName or @windows_user_nameThe Windows login of the current user