Exercise: Using the Comparison Operator

  To script the Comparison command button to make a comparison and return an alert:

  1. Select the Comparison button and choose Dashboard, Scripts.

  2. Use the Object browser to navigate to Application, then Methods, and then double-click Alert.

  3. Click in the parentheses of the Alert method.

  4. Navigate to ActiveDocument, then Sections, then RevByTime, then Properties and then double-click ChartType.

    Your script should look like this:

    Application.Alert(ActiveDocument.Sections["RevByTime"].ChartType)
  5. Type the comparison operator (==) after the property ChartType.

  6. Navigate to Constants, then BqChartType and then double-click bqChartTypeVerticalBar.

    Your script should now look like this:

    Application.Alert(ActiveDocument.Sections["RevByTime"].ChartType==bqChartTypeVerticalBar)
  7. Click OK to save the script and close the Script Editor.

    The Comparison button is ready to test.

In Run mode, click the Comparison button. The alert displays true if the chart is a vertical bar chart, false if the chart is any other chart type.