ImpactECS In-Depth: Item Type Actions
Did you know that ImpactECS models can support user-defined context menu options? The Item Type Actions feature uses custom Script Modules to generate context menus designed to simplify the way users interact with ImpactECS. Not to be confused with cell actions, this article covers the basics of Item Type Actions and highlights a few ways the feature is implemented in real life.
Item Type Action Basics
Setting up Item Type Actions requires model builders perform two steps – displaying the action in the context menu and writing the Script Module to perform the action.
Step 1: Display the Action in the Context Menu
Since this function is powered by scripts, the first step is creating a folder “Actions” in the Script Module folder to help ImpactECS locate the available actions. Once created, add sub-folders for each Item Type that will benefit from context menu functionality (i.e. Calculations, Cost Objects, Forms, …).
In the example above, notice there is a Script Modules folder inside Script Modules/Actions that has two scripts to generate context menus – Backup Script Modules and View Script Module History. Now when a user right-clicks any script in ImpactECS, those two action functions are available on the context menu as shown below.
Step 2: Write the Item Type Action Script
ImpactECS offers two arrays programmers can use to script Item Type Actions. SelectedItemNames provides a list of the items the user has selected, while SelectedFolderIDs provides a list of the folders the user has selected. The script below supports the action “Backup Script Modules”.
Ways to use Item Type Actions
The sky is the limit when it comes to Item Type actions, and model builders should consider the best use of these actions to improve model usability and acceptance. Here are a few popular ways ImpactECS models use Item Type Actions:
- Backups: Quickly save items to flat files
- View History: See the modification history of the selected item
- Export and Import Items: Move data between ImpactECS and external systems
- Code Management: Link with external source code management tools
- Modify Items: Make updates and change properties of selected items
Effective use of Item Action Types can significantly improve the user experience of ImpactECS models. Poll your users and identify a few winning ways your can make model users happy with convenient and relevant context menus. Have questions? Check with our team at firstname.lastname@example.org for more info or to get help implementing this feature.