Exercise: Using Operators as Characters

  To create a command button that opens a file:

  1. Open Sample3.bqy and insert a new Dashboard section. Rename it Strings Dashboard.

    Refer toCreating a New Dashboard Section for instructions on renaming a section.

  2. Drag a command button from the Elements pane to the Content pane.

  3. Select the command button and choose Dashboard, then Scripts.

  4. Use the Object browser to navigate to Application, then Documents, then Methods and then double-click Open.

    The Description pane shows that the arguments for the Open method are strings: Document Open(String Filename, [optional] String DisplayName). The second argument is not required and this script does not include it. step 6 through step 7 adds the String Filename argument to the Open method.

    Caution!

    Strings must be quoted! The Documents.Open() method requires string arguments.

  5. Switch to the desktop and find and copy the path (not the file name) to the file you wish to open.

    For the What’s New.bqy document, the default path is C:\Program Files\Brio\BrioQuery\Samples.

  6. Add the path to the file inside the parentheses.

    1. Click inside the parentheses, type quotes, and paste the path plus an ending slash between the quote marks.

    2. Type a backslash (\) in front of each slash in the file path.

      The script should look similar to

      Documents.Open("C:\\Program Files\\Brio\\BrioQuery\\Samples\\")
  7. Copy the file name and paste it at the end of the path in the current script.

    1. Switch back to the desktop and copy the exact file name.

    2. Return to Intelligence Clients and open the Script Editor on the command button.

    3. Click after the last slash in the path, before the ending quote mark, and paste the file name.

      The script should look similar to:

      Documents.Open("C:\\Program Files\\Brio\\BrioQuery\\Samples\\What's New.bqy")
  8. Click OK to save the script and close the Script Editor.

  9. Toggle to Run mode and click the command button to open the file.