6.6 Using the Script Editor

You use the Script Editor to add content to a new script, to edit existing scripts, and to run and delete scripts in the script repository.

6.6.1 Editing an Existing Script

Learn how to edit an existing SQL script.

To edit a SQL script:

  1. On the Workspace home page, click SQL Workshop and then SQL Scripts.

    The SQL Scripts page appears.

  2. You can load a script into the editor as follows:
    • In Icons view, click the script icon.

    • In Report view, click the Edit icon.

    The Script Editor appears.

  3. Edit the script.

    Note that new lines are automatically indented to the previous line start column. Other features of the Script Editor include:

    • Undo - Use to undo the last edit.

    • Redo - Use to reapply the last undone edit.

    • Find - Click the Find icon (which resembles a magnifying glass) to perform a basic search.

    • Replace - Click the Replace icon (which resembles a two-sided arrow) to replace existing code.

    • Cut, Copy, and Paste - Use standard edit controls to cut, copy and paste content in the Script Editor.

    • Auto Complete - Click the Auto Complete icon to complete the command.

  4. Click Apply Changes to save your script.

    The SQL Scripts page appears.

You can test your script during editing by running the script to reveal errors.

6.6.2 Script Editor Controls

Controls and buttons available within the Script Editor.

Table 6-* describes the buttons and controls available within the Script Editor

Button Descriptions
Cancel Cancel the editing session and exit the Script Editor without saving changes made since the last save.
Download Saves a copy of the current script to your local file system. Enter a name for the script on your local file system and a directory path.
Delete Removes the current script from the Script Repository.
Save Saves the currently script. Save is disabled if you edit the Script Name. Instead use Apply Changes.
Create App

Launches the Create App Wizard based on the table. Only works with scripts that add tables to the schema.

Tip: You must run the script that adds tables to the schema first.

Apply Changes Saves the script and returns to the SQL Scripts report.
Run Submits the script for execution.
Undo (Ctrl+Z) Removes, or undoes, the most recent line edit made in the Script Editor.
Redo (Ctrl+Shift+Z) Repeats the most recent line edit made in the Script Editor.
Find (Ctrl+F) Click the Find icon (which resembles a magnifying glass) to perform a basic search.
Auto Complete (Ctrl+Space) Click the Auto Complete icon (which resembles upper case letter A) view possible auto complete suggestions.
Context Menu

Right-click and select one of the following:

  • Change All Occurrences (Ctrl+F2) - Right click and select Change All Occurrences from the context menu.

  • Cut

  • Copy

  • Command Palette (F1) - Displays the Command Palette.

Command Palette (F1)

Right click to display a context menu and select Command Palette. The Command Palette includes over 80 commands including:

  • Replace (Ctrl+H)

  • Replace with Next Value (Ctrl+Shift+.)

  • Replace with Previous Value (Ctrl+Shift+,)

Multi Cursor Selection
  • Add cursors at arbitrary positions - Select a position with your mouse and press Shift+Alt+click (Shift+Option+click on macOS).

  • Set cursors above the current position - Select a position with your mouse and press Ctrl+Alt+Up (Option+Command+Up on macOS).

  • Set cursors below the current position - Select a position with your mouse and press Ctrl+Alt+Down (Option+Command+Down on macOS).

Settings menu

The Settings menu displays on the right side and includes the following options:

  • Indentation - Options include: Tab Inserts Spaces, Tab Size, and Indent Size.

  • Themes - Options include: Automatic, Light, Dark, and High Contrast Dark.

  • Show Ruler.