Usage and example of Contextual Toolbar

These examples describe how to create a report and configure the Contextual Toolbar web extension. In these examples, a contextual toolbar is created above a data grid. In the toolbar, these options are displayed:

  • Title
  • Menu button for export as an Excel or .pdf file
  • Selected only switch

Creating a report for the Contextual Toolbar web extension

  1. Create an Application Studio report with the Contextual Toolbar name.
  2. Open the Accessories panel.
  3. Create a report variable with the SelectedOnly name. The variable stores the state of the Selected only switch.
  4. In the properties of the variable, specify this information:
    Value (.Text)
    Specify =FALSE.
    Default Value (.DefaultText)
    Specify =FALSE.
  5. Create a report variable with theTitle name. The variable value shows the number of selected elements.
  6. Create a report variable with theData name. The variable value stores an .xml value with the data grid elements.
  7. In the Value (.Text) variable property field, specify this .xml formula:
    <TABLE>
    	<ROW NAME="1">
    		<PROPERTY NAME="CAPTION" VALUE="AAA" />
    	</ROW>
    	<ROW NAME="2">
    		<PROPERTY NAME="CAPTION" VALUE="BBB" />
    	</ROW>
    	<ROW NAME="3">
    		<PROPERTY NAME="CAPTION" VALUE="CCC" />
    	</ROW>
    	<ROW NAME="4">
    		<PROPERTY NAME="CAPTION" VALUE="DDD" />
    	</ROW>
    	<ROW NAME="5">
    		<PROPERTY NAME="CAPTION" VALUE="EEE" />
    	</ROW>
    	<ROW NAME="6">
    		<PROPERTY NAME="CAPTION" VALUE="FFF" />
    	</ROW>
    	<ROW NAME="7">
    		<PROPERTY NAME="CAPTION" VALUE="GGG" />
    	</ROW>
    </TABLE>
  8. Create a formula list with a auto-generated name.
  9. Drag the formula list to the B5:D5 cell range in the spreadsheet.
  10. Open the Report Objects folder, right-click a hyperblock, and select Edit.
  11. In the List Designer panel, click Add and select the Data report variable.
  12. Click OK.
  13. In the Caption field, select Caption and click Apply changes to the list.
  14. Right-click the hyperblock and select Format Hyperblock.
  15. In the Format Hyperblock dialog box, specify this information:
    Value
    Specify ="Unique Name".
    Display Value
    Specify ="Caption".
    Position
    Specify C5.
  16. Click OK.

Configuring an item data table for the Contextual Toolbar web extension

Item data properties define button properties as a cell range in a data table or as an .xml definition that is stored as a cell reference.

These values are supported by the column properties of the data table:

  • ID: Refers to the unique button name from the item list.
  • Caption: Defines the displayed button text.
  • Enabled: The button is enabled or disabled with the TRUE or FALSE values, respectively. TRUE is used if a cell is blank.
  • Visible: The button is displayed or hidden with the TRUE or FALSE values, respectively TRUE is used for a cell is blank.
  • Parent: If you create a menu button, the value defines the unique name of the parent button. To add an option to the More button, specify more.
  • MediaName: Specifies the shared image unique name of an icon. Only .svg icons without fill attributes are supported.
  • Tooltip: Defines a text that is displayed when you hover over the button.
  1. Create a table with these values, including the cell references and column headings:
    B13:B16 C13:C116 D13:D16 E13:E16 F13:F16 G13:G16 H13:H16
    ID Caption Enabled Visible Parent MediaName Tooltip
    export Export Common_toolbar_export Export
    exportPDF Export to PDF export
    exportXLS Export to Excel export
  2. Right-click the B5 cell and select Format Cells… > Image .
  3. In the Shared Images field, select the common_Checkbox_Empty_Normal image and specify this information:
    Size
    Select Keep Size.
    Alignment
    Select Center.
    Horizontal
    Select Center.
    Note: All used images must be available in the repository. You can replace the image from this example with an image that is stored in the repository.
  4. Click OK.
  5. In the B5 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Set Parameters.
      Condition
      Specify =TRUE.
      Mode
      Specify Hyperlink.
    • Parameters section:
      Name
      Specify the Data action.
      Property
      Specify Value(.Text).
      Value
      Specify this formula: =SETPROPERTY(ReportVariables.data.Text,$C5,"selected",GETPROPERTY(ReportVariables.data.Text,$C5,"selected")<>"True").
      Name
      Specify the Data report variable.
      Property
      Specify Value(.Text).
      Value
      Specify this formula: =Actions.Data.Text.
      Name
      Specify the SelectedOnly report variable.
      Property
      Specify Value(.Text).
      Value
      Specify this formula: =IF(FINDKEYSBYFILTER(Actions.data.Text,FILTER("*","selected","TRUE"),",")="",FALSE,ReportVariables.selectedOnly.Text).
  6. Repeat step 5 for the C5 cell.

Configuring the Contextual Toolbar web extension

  1. Insert the Contextual Toolbar web extension into the B4:D4 cell range.
  2. In the Format Web Extension dialog box, specify this information:
    List of Items
    Specify =B14:B16.
    Item Data
    Specify =B13:H16.
    Padding
    Specify ="@".
    Selected Only
    Specify =C19.
    Toolbar Title
    Specify =C20.
    Close Action
    Specify =C21.
  3. Click the Availability tab and clear the Clear object check box.
  4. Click OK.
  5. Optionally, specify a customized text for printing instead of the toolbar object. For example, to show the number of selected rows, specify this formula in the B4 cell: =IF(ReportVariables._CurrentPrintMode.Text<>"",C20 & " Selected","").

Configuring toolbar actions

  1. In the C19 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Set Parameters.
      Condition
      Specify =TRUE.
      Mode
      Specify Web Extension.
    • Input/Options section:
      Name
      Specify Refresh in web.
      Value
      Specify Whole Report.
    • Parameters section:
      Name
      Specify the SelectedOnly report variable.
      Property
      Specify Value(.Text).
      Value
      Specify this formula: =ReportVariables.selectedOnly.Text<>"true".

    The Selected only switch is configured with this action.

  2. In the B19 cell, specify Selected Only.
  3. In the C20 cell, specify this formula: =ARRAYLENGTH(FINDKEYSBYFILTERA(ReportVariables.data.Text,FILTER("*","selected","TRUE"))).
  4. In the C20 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Set Parameters.
      Condition
      Specify =TRUE.
      Mode
      Specify Edited cell.
    • Parameters section:
      Name
      Specify the Title report variable.
      Property
      Specify Value(.Text).
      Value
      Specify =C20.

    Selected elements for the toolbar title are counted with this action.

  5. In the B20 cell, specify Title.
  6. In the C21 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Set Parameters.
      Condition
      Specify =TRUE.
      Mode
      Specify Web Extension.
    • Parameters section:
      Name
      Specify the Data report variable.
      Property
      Specify Value(.Text).
      Value
      Specify this formula: =SETPROPERTY(ReportVariables.data.Text,"*","Selected","").
      Name
      Specify the SelectedOnly report variable.
      Property
      Specify Value(.Text).
      Value
      Specify =FALSE.

    The toolbar is closed with this action.

  7. In the B21 cell, specify Close action.

Configuring button actions

  1. In the B15 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Export report.
      Condition
      Specify =TRUE.
      Mode
      Specify Web Extension.
    • Input/Options section:
      Name
      Specify Export type.
      Value
      Specify PDF.
      Name
      Specify File extension.
      Value
      Specify pdf.

    A .pdf file is exported with this action.

  2. In the B16 cell, define an action and specify this information:
    • Actions section:
      Type
      Specify Export report.
      Condition
      Specify =TRUE.
      Mode
      Specify Web Extension.
    • Input/Options section:
      Name
      Specify Export type.
      Value
      Specify Excel Workbook (*.xlsx).
      Name
      Specify File extension.
      Value
      Specify xlsx.

    An .xlsx file is exported with this action.

  3. Save the report.
    You can view the report in a web browser.