Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

Adding Actions To Data Grids

To make it easy for users to access certain functionality, you can create a toolbar or add a context menu to a cell within your Data Grid. You can also add inactive buttons to Data Grid toolbars, allowing for a unified look between tabs.

For more information, see the "Command" parameter in Syntax.

Action

Use this function to add a toolbar icon or a context menu with an associated action in a Data Grid. For example, you can use actions to run a procedure, open a new Data Grid, or run a model.

When a user right-clicks a cell or clicks a toolbar button, an action is triggered and specific context variables are populated. The following table lists the variables that are associated with actions in a Data Grid. 

Variable Description

C_CONTEXT

If a user clicks a cell in the Data Grid, the return value for this variable is CELL. If they click a toolbar action, the return value is DATAGRID.

For example, $C_CONTEXT$ resolves to CELL or $C_CONTEXT$ resolves to DATAGRID.

C_DATAAREA

This variable returns the name of the data area.

For example $C_DATAAREA$ resolves to SampleDA.

C_CELLVALUE

This variable returns the value of the intersection that the user right-clicked. This variable is not populated for toolbar actions.

For example, $C_CELLVALUE$ resolves to 200.

C_ROWS

This variable returns the dimension in the rows orientation of the Data Grid. If the Data Grid has nested dimensions in the rows orientation, the variable returns the dimensions in order from outer to inner.

For example, $C_ROWS$ resolves to ENTITIES, ACCOUNTS.

C_COLUMNS

This variable returns the dimension in the columns orientation of the Data Grid. If the Data Grid has nested dimensions in the columns orientation, the variable returns the dimensions in order from outer to inner.

For example, $C_COLUMNS$ resolves to TIMEPER.

C_Dimension

This variable returns the name of the symbol for each dimension at the intersection that the user right-clicked. For toolbar actions, these variables are populated only for dimensions that are not in the rows or columns orientation.

For example, $C_CURRENCIES$ resolves to "CAD" or $C_ENTITIES$ resolves to "TORONTO".

The names of variables in Longview Application Framework to be used in these context variables are limited to 31 characters. The convention is C_Dimension (where Dimension is the first 26 characters of the dimension name). In the case where the first 26 characters of the dimension names are the same, the variables are named C_Dimension_N (where Dimension is the first 26 characters of the dimension, and N is the dimension number).

You can reference any of the above context variables in Longview Application Framework documents.

Syntax

Action "Text", "Image", "Command", "Helptext"[, Location[, "cellTypeExpression"]]

where:

  • Text is the text to display in the toolbar. To display an image-only icon, omit this parameter and use two double quotation marks ( "" ). You must specify either Text or Image.
  • Image is the path to the image to display as the toolbar or context menu icon. The default path is the path specified in the <rootpath> tag of the .lvapp file. If no root path is specified, the system assumes the root path is the applications folder in the working directory. To display a text-only icon, omit this parameter and use two double quotation marks ( "" ). You must specify either Text or Image.

    Note: Longview recommends using 16 x 16 pixel images to optimize the appearance of your Data Grid toolbar.

  • Command is the Longview Application Framework command to execute when a user clicks the toolbar icon or context menu item. To display a disabled icon, omit this parameter and use two double quotation marks ( "" ). You can embed the Launch commands in the Command parameter.
    For more information, see Launch App, Launch Component, Launch ReportViewer and Launch URL.
  • Helptext is the tooltip text that appears when a user hovers over the toolbar icon. To omit tooltip text, use two double quotation marks ( "" ).
  • Location is optional and defines the location of the action in the user interface. To add multiple locations, separate the parameters with a pipe ( | ). If you do not specify a location, the action item is added to the toolbar. Location can be any of the following:
    Parameter Description

    TOOLBAR

    Adds the action to the Data Grid toolbar.

    CELLCONTEXT

    Adds the action as part of the context menu for a cell.

  • cellTypeExpression can be specified only if Location is also specified. This parameter is optional and is an expression that resolves to TRUE or FALSE and, when the expression resolves to TRUE for a cell, makes the context menu available. Cell type expressions can use NOT, AND, and OR with any of the following cell types: 
    Cell type Description

    PARENT

    Applies the context menu action to all relevant parent cells.

    LEAF

    Applies the context menu action to all relevant leaf cells.

    STATIC

    Applies the context menu action to all relevant static cells.

    WRITABLE

    Applies the context menu action to all relevant writable cells.

    READONLY

    Applies the context menu action to all relevant read-only cells.

For example, to enable a context menu action on static parents only, the expression is PARENT AND STATIC. A cell type expression is optional. If you do not specify an expression, the context menu action is available for all cells.

Note: If you require double quotation marks (“) in the parameters for the Action, precede them with a backslash.

Action "Clear", "Common/images/toolbar/Eraser.png", "Run Procedure NII\NII_View_Zero_CashFlow.lvpro", "Clear Cashflow", TOOLBAR  

 

Action "Calculation", "Common/images/toolbar/calculator.gif", "Run Procedure \“NII\NII_View_CDCalc.lvpro\”", "Deposit Calculator", CELLCONTEXT, "LEAF"

  Action "", "Images/copy.ico", "Run"  

Action “Open”, “Common/images/toolbar/Open.png”, “Launch App \“HelloWorldApp\””, “Open App”, TOOLBAR

DynamicModel

Use this function to specify a model to run when a user enters data manually or uses a drop-down list in a Data Grid.

Note: Models run before any data rolls up.

Before the model runs, the following variables are populated and are available for use in the model:

  • C_CONTEXT
  • C_DATAAREA
  • C_CELLVALUE
  • C_ROWS
  • C_COLUMNS
  • C_DIMENSION

For more information on these variables, see Working with context variables.

Syntax:

DynamicModel "Model"

where:

  • Model is the model to run, enclosed in double quotation marks. The model must exist in the ...\DataServers\<LID>\applications directory, where LID is the Longview Identifier for your system. You can specify multiple DynamicModel statements. Models run in the order in which they appear in the Data View definition (.lvdvw) file.

Example:

DynamicModel "RecalcForecast.lvmod"

SystemAction

Use this function to add a button with a predefined system action to the toolbar. For example, you can use system actions to include toolbar buttons that allow users to export to Microsoft Excel, specify whether they view symbol names, descriptions, or an attribute value in a Data Grid, preview printing options, or close the Data Grid.

Syntax:

SystemAction Action, "Text", "Image", "Helptext"

where:

  • Action is the system action to add to the toolbar and can be one of the following values:
    Value Description

    ExporttoExcel

    Adds a button that allows users to export the current view to Microsoft Excel.

    PrintPreview

    Adds a button that allows users to open a Print Preview dialog.

    Close

    Adds a button that allows users to signal that they are finished with the current Data Grid. This action does not trigger OnClose behavior, but is equivalent to using the SHOW RETURN command. For more information, see OnClose and Show Return.

    Options

    Adds a button that allows users to access the following:

    Value Description

    Display dialog box

    Allows users to specify whether to view symbol names, descriptions, and/or a symbol’s attribute value for each dimension. You can specify the default selection for display options using the “DimensionTitles” function. For more information, see DimensionTitles.

    Apply Highlighting toggle

    Allows users to remove or apply highlighting, defined by the “ConditionalCellStyle” function. For more information, see ConditionalCellStyle.

    Apply Filters toggle

    Allows users to remove or apply filters, defined by the Filter function. For more information, see Filter.

    Apply Symbol Suppression toggle

    Allows users to remove or apply symbol suppression, defined by the SymbolSuppress function. For more information, see SymbolSuppress.

    The Apply Symbol Suppression toggle is available to users only if you use the SymbolSuppress function on the innermost down and/or across dimensions in your Data View definition file.

  • Text is the text to display on the toolbar button. If you want to use the default text, use two double quotation marks ( "" ). For ExporttoExcel, the default text is Export to Excel, and for Option, the default text is Options. For PrintPreview, the default text is Print Preview.
  • Image is the filename of the to display on the toolbar button. The default path is the path specified in the <rootpath> tag of the .lvapp file. If no root path is specified, the system assumes the root path is the applications folder in the working directory. If you want to use a default icon, use two double quotation marks ( "" ).
  • Helptext is the tooltip text that appears when a user hovers over the toolbar button. If you do not want tooltip text, use two double quotation marks ( "" ).

Example:

SystemAction ExporttoExcel, "Export",

"Common/images/toolbar/Excel.png", "Export current view to Excel"

SystemAction Options, "", "", "Change display options"

SystemAction Close, "","",""

Specifying the order of toolbar actions

You can specify the order in which you want actions to appear on the toolbar by controlling the order of the corresponding Action and SystemAction functions in your Data View file. If you want to, for example, always have your custom Close button as the last icon on the toolbar, place the Close Action at the bottom of the list of functions.

Example:

Action "Instructions", "users.ico", "RUN PROCEDURE ShowGreeting.lvpro", "Show Instructions"

 

Action "Import Data", "import.gif", "RUN PROCEDURE ImportEmps.lvpro", "Import Existing Salaries"

SystemAction ExporttoExcel, "", "", ""

SystemAction PrintPreview, "", "", ""

Action "Close", "Common/images/toolbar/exit.gif", "Show RETURN", "Close"

The above example displays the Close button as the last icon on the toolbar.

Published:

Adding Actions To Data Grids

To make it easy for users to access certain functionality, you can create a toolbar or add a context menu to a cell within your Data Grid. You can also add inactive buttons to Data Grid toolbars, allowing for a unified look between tabs.

For more information, see the "Command" parameter in Syntax.

Action

Use this function to add a toolbar icon or a context menu with an associated action in a Data Grid. For example, you can use actions to run a procedure, open a new Data Grid, or run a model.

When a user right-clicks a cell or clicks a toolbar button, an action is triggered and specific context variables are populated. The following table lists the variables that are associated with actions in a Data Grid. 

Variable Description

C_CONTEXT

If a user clicks a cell in the Data Grid, the return value for this variable is CELL. If they click a toolbar action, the return value is DATAGRID.

For example, $C_CONTEXT$ resolves to CELL or $C_CONTEXT$ resolves to DATAGRID.

C_DATAAREA

This variable returns the name of the data area.

For example $C_DATAAREA$ resolves to SampleDA.

C_CELLVALUE

This variable returns the value of the intersection that the user right-clicked. This variable is not populated for toolbar actions.

For example, $C_CELLVALUE$ resolves to 200.

C_ROWS

This variable returns the dimension in the rows orientation of the Data Grid. If the Data Grid has nested dimensions in the rows orientation, the variable returns the dimensions in order from outer to inner.

For example, $C_ROWS$ resolves to ENTITIES, ACCOUNTS.

C_COLUMNS

This variable returns the dimension in the columns orientation of the Data Grid. If the Data Grid has nested dimensions in the columns orientation, the variable returns the dimensions in order from outer to inner.

For example, $C_COLUMNS$ resolves to TIMEPER.

C_Dimension

This variable returns the name of the symbol for each dimension at the intersection that the user right-clicked. For toolbar actions, these variables are populated only for dimensions that are not in the rows or columns orientation.

For example, $C_CURRENCIES$ resolves to "CAD" or $C_ENTITIES$ resolves to "TORONTO".

The names of variables in Longview Application Framework to be used in these context variables are limited to 31 characters. The convention is C_Dimension (where Dimension is the first 26 characters of the dimension name). In the case where the first 26 characters of the dimension names are the same, the variables are named C_Dimension_N (where Dimension is the first 26 characters of the dimension, and N is the dimension number).

You can reference any of the above context variables in Longview Application Framework documents.

Syntax

Action "Text", "Image", "Command", "Helptext"[, Location[, "cellTypeExpression"]]

where:

  • Text is the text to display in the toolbar. To display an image-only icon, omit this parameter and use two double quotation marks ( "" ). You must specify either Text or Image.
  • Image is the path to the image to display as the toolbar or context menu icon. The default path is the path specified in the <rootpath> tag of the .lvapp file. If no root path is specified, the system assumes the root path is the applications folder in the working directory. To display a text-only icon, omit this parameter and use two double quotation marks ( "" ). You must specify either Text or Image.

    Note: Longview recommends using 16 x 16 pixel images to optimize the appearance of your Data Grid toolbar.

  • Command is the Longview Application Framework command to execute when a user clicks the toolbar icon or context menu item. To display a disabled icon, omit this parameter and use two double quotation marks ( "" ). You can embed the Launch commands in the Command parameter.
    For more information, see Launch App, Launch Component, Launch ReportViewer and Launch URL.
  • Helptext is the tooltip text that appears when a user hovers over the toolbar icon. To omit tooltip text, use two double quotation marks ( "" ).
  • Location is optional and defines the location of the action in the user interface. To add multiple locations, separate the parameters with a pipe ( | ). If you do not specify a location, the action item is added to the toolbar. Location can be any of the following:
    Parameter Description

    TOOLBAR

    Adds the action to the Data Grid toolbar.

    CELLCONTEXT

    Adds the action as part of the context menu for a cell.

  • cellTypeExpression can be specified only if Location is also specified. This parameter is optional and is an expression that resolves to TRUE or FALSE and, when the expression resolves to TRUE for a cell, makes the context menu available. Cell type expressions can use NOT, AND, and OR with any of the following cell types: 
    Cell type Description

    PARENT

    Applies the context menu action to all relevant parent cells.

    LEAF

    Applies the context menu action to all relevant leaf cells.

    STATIC

    Applies the context menu action to all relevant static cells.

    WRITABLE

    Applies the context menu action to all relevant writable cells.

    READONLY

    Applies the context menu action to all relevant read-only cells.

For example, to enable a context menu action on static parents only, the expression is PARENT AND STATIC. A cell type expression is optional. If you do not specify an expression, the context menu action is available for all cells.

Note: If you require double quotation marks (“) in the parameters for the Action, precede them with a backslash.

Action "Clear", "Common/images/toolbar/Eraser.png", "Run Procedure NII\NII_View_Zero_CashFlow.lvpro", "Clear Cashflow", TOOLBAR  

 

Action "Calculation", "Common/images/toolbar/calculator.gif", "Run Procedure \“NII\NII_View_CDCalc.lvpro\”", "Deposit Calculator", CELLCONTEXT, "LEAF"

  Action "", "Images/copy.ico", "Run"  

Action “Open”, “Common/images/toolbar/Open.png”, “Launch App \“HelloWorldApp\””, “Open App”, TOOLBAR

DynamicModel

Use this function to specify a model to run when a user enters data manually or uses a drop-down list in a Data Grid.

Note: Models run before any data rolls up.

Before the model runs, the following variables are populated and are available for use in the model:

  • C_CONTEXT
  • C_DATAAREA
  • C_CELLVALUE
  • C_ROWS
  • C_COLUMNS
  • C_DIMENSION

For more information on these variables, see Working with context variables.

Syntax:

DynamicModel "Model"

where:

  • Model is the model to run, enclosed in double quotation marks. The model must exist in the ...\DataServers\<LID>\applications directory, where LID is the Longview Identifier for your system. You can specify multiple DynamicModel statements. Models run in the order in which they appear in the Data View definition (.lvdvw) file.

Example:

DynamicModel "RecalcForecast.lvmod"

SystemAction

Use this function to add a button with a predefined system action to the toolbar. For example, you can use system actions to include toolbar buttons that allow users to export to Microsoft Excel, specify whether they view symbol names, descriptions, or an attribute value in a Data Grid, preview printing options, or close the Data Grid.

Syntax:

SystemAction Action, "Text", "Image", "Helptext"

where:

  • Action is the system action to add to the toolbar and can be one of the following values:
    Value Description

    ExporttoExcel

    Adds a button that allows users to export the current view to Microsoft Excel.

    PrintPreview

    Adds a button that allows users to open a Print Preview dialog.

    Close

    Adds a button that allows users to signal that they are finished with the current Data Grid. This action does not trigger OnClose behavior, but is equivalent to using the SHOW RETURN command. For more information, see OnClose and Show Return.

    Options

    Adds a button that allows users to access the following:

    Value Description

    Display dialog box

    Allows users to specify whether to view symbol names, descriptions, and/or a symbol’s attribute value for each dimension. You can specify the default selection for display options using the “DimensionTitles” function. For more information, see DimensionTitles.

    Apply Highlighting toggle

    Allows users to remove or apply highlighting, defined by the “ConditionalCellStyle” function. For more information, see ConditionalCellStyle.

    Apply Filters toggle

    Allows users to remove or apply filters, defined by the Filter function. For more information, see Filter.

    Apply Symbol Suppression toggle

    Allows users to remove or apply symbol suppression, defined by the SymbolSuppress function. For more information, see SymbolSuppress.

    The Apply Symbol Suppression toggle is available to users only if you use the SymbolSuppress function on the innermost down and/or across dimensions in your Data View definition file.

  • Text is the text to display on the toolbar button. If you want to use the default text, use two double quotation marks ( "" ). For ExporttoExcel, the default text is Export to Excel, and for Option, the default text is Options. For PrintPreview, the default text is Print Preview.
  • Image is the filename of the to display on the toolbar button. The default path is the path specified in the <rootpath> tag of the .lvapp file. If no root path is specified, the system assumes the root path is the applications folder in the working directory. If you want to use a default icon, use two double quotation marks ( "" ).
  • Helptext is the tooltip text that appears when a user hovers over the toolbar button. If you do not want tooltip text, use two double quotation marks ( "" ).

Example:

SystemAction ExporttoExcel, "Export",

"Common/images/toolbar/Excel.png", "Export current view to Excel"

SystemAction Options, "", "", "Change display options"

SystemAction Close, "","",""

Specifying the order of toolbar actions

You can specify the order in which you want actions to appear on the toolbar by controlling the order of the corresponding Action and SystemAction functions in your Data View file. If you want to, for example, always have your custom Close button as the last icon on the toolbar, place the Close Action at the bottom of the list of functions.

Example:

Action "Instructions", "users.ico", "RUN PROCEDURE ShowGreeting.lvpro", "Show Instructions"

 

Action "Import Data", "import.gif", "RUN PROCEDURE ImportEmps.lvpro", "Import Existing Salaries"

SystemAction ExporttoExcel, "", "", ""

SystemAction PrintPreview, "", "", ""

Action "Close", "Common/images/toolbar/exit.gif", "Show RETURN", "Close"

The above example displays the Close button as the last icon on the toolbar.

For an optimal Community experience, Please view on Desktop