Using the Script Editor

Using the script editor lets you write scripts for each widget and thus create interactive and highly custom-defined analytic applications. To enable interactivity, you configure the behavior of widgets and write widget scripts that are executed when the user performs an action in the executed application. For example, you can place the Button widget in the application and assign a script to the Button’s onClick event. You can also write scripts that are based on other system events like the onInit event of the application or scripts that are executed whenever data is changed.

Context

Scripts consist of one or more statements written in a JavaScript-based language that follow a specific syntax. You write scripts in the script editor. You can find all objects, fields and functions available in scripts in the Analytics Designer API Reference on SAP Help Portal at Analytics Designer API Reference.

Procedure

  1. Add a widget to the canvas, for example a dropdown.

    The specific icon and name of the application is displayed in the Outline.

  2. Hover the mouse over the widget name.

    An button is displayed right next to the widget name.

  3. Click on the button. If the widget supports multiple events, select one of the events and click on the button.
    Note

    You can also use the button in the quick action menu of each widget you have placed in your application.

    The script editor opens in a new tab which displays the name of the event (example: "onSelect") and the widget or application to which the script will be assigned (example: "table_1 - onSelect").

  4. Type in one or more statements with this syntax: <ComponentVariable>.<function>(<arguments>);.
    Tip

    You can activate the content assistance at any place in the script by pressing CTRL + + + Space on your keyboard.

  5. You can change the order of the tabs by dragging and dropping a tab horizontally.
  6. When you have finished your script, close the tab by clicking on the button at the right of the tab.

    To reopen the script editor, again click the button next to the widget in the Outline.