Action Menus

Action Menus

Developers can customize the Actions 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:

  • Executing macros
  • Executing Windows Shell and CMD commands
  • Exporting worksheets
  • Creating PDF files
  • Refreshing data
  • Selecting, hiding, and showing worksheets

See more details at Handler Types.

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

For example:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODETARGET_WORKSHEETMENU_ORDEREDIT_PARAMETERS
 s04usp_order_formActionss04xl_actions_items_print_as_htmlPROCEDURE11
 s04usp_order_formActionss04MenuSeparator40MENUSEPARATOR40
 s04usp_order_formActionss04xl_actions_items_insert_itemPROCEDURE_Reload41

This sample has two items 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.

Here is another sample:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODETARGET_WORKSHEETMENU_ORDEREDIT_PARAMETERS
 s05usp_order_headerActionss05xl_actions_order_createPROCEDURE_reload110
 s05usp_order_headerActionss05MenuSeparator30MENUSEPARATOR30
 s05usp_order_headerActionss05xl_actions_order_printPROCEDURE310
 s05usp_order_headerActionss05Create Quote & Invoice PDFPDFquote,invoice32
 s05usp_order_headerActionss05Create Quote & Invoice XSLXREPORTquote,invoice33

It also contains procedures. Pay attention to zeros in the EDIT_PARAMETERS column. You can use this to suppress the dialog box used to edit parameters.

The PDF and REPORT handlers have lists of worksheets used to generate PDF and export worksheets in the TARGET_WORKSHEET field.

See more details at Handler Types.

Context Parameters

Application menu handlers can use values of the active query parameters and the following context parameters.

Contrary to the context menu handlers, these handlers can have no active row context.

Parameter NameValue
@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