Script Editor

Work with your data.

Overview of the Script Editor

  1. This is where you can write our edit your script.

  2. In the additional options, you can make a copy of your script.

  3. Here you can edit your input data (same as in 7.) by selecting datasets.

  4. With the Run button, you can test your script. The results will appear in a table at the bottom of your screen.

  5. Save your script if you want to keep it.

  6. In the General tab in the sidebar name and description can be defined as well as the used programming language.

  7. In the Data and Script tabs in the sidebar, you can add datasets, .rds or .pickle files and other scripts which then can be used in your script (more on that in a later section).

  8. In the Results tab in the sidebar, the result variables are defined (more on that in a later section).

  9. Select a programming language, either R or Python, to write your script with.

  10. Check Activate error logging if you want to save possible errors that occur when your script is run (more in a later section).

Input Data

To add input data to your script you have multiple options depending on what data you want to import. If you want to add datasets to your script, you can use the Edit Data button in the header bar (3.) or the Add Data button in the Data tab. To add scripts, use the Add Data button in the Scripts tab.

After selecting any of these options, a window will popup where you will be shown all available datasets or scripts, depending on which Add Data button you clicked. Find the dataset or script you want to add, enter how many rows of it you want to include in your script in the corresponding input box and click the Add Button next to it. If you're done, click the Finish button to return to the script editor.

Datasets are currently limited to one million rows, scripts with one thousand rows.

Additionally you can add as many datasets as you want, but scripts are limited to a maximum of three.

ExampleDataset$Timestamp

if you selected R as a language and

ExampleDataset['Timestamp']

if you selected Python. For R the dataset will be imported as data.frame and for Python, it will be a dictionary, where the keys are the column names and the value connected to the key is a list containing the entries of the regarding column.

Results

Navigate to the Results tab in the right sidebar. If you click the Add Result button a window will open. There you can define your result variables. When your script is executed (either by clicking the Run button or because it is used by a widget or automation) the last assigned value of each result variable will be used as output.

Note: If you have multiple result variables all assigned output values need to have the same length because the results will be transformed into some kind of a tabular format.

Executing a script (Run)

You can execute your script with the chosen datasets and result variables to check if the script leads to the expected results.

Below the script, you can see the data of your selected datasets which were used for the script execution in the Datasets tab, and the result of the script on the Output tab.

Notice that you can hide the results window if you need to have a closer look at your script again.

Note: Sub-scripts execution of a main script is made in a synchronous manner (one by one) which means real-time data synchronization between the sub-scripts is not supported at the moment. For example, having a main script with another three subscripts(each with a dataset). Firstly the three subscripts will be called one by one synchronously, and then the main script will be called with the subscripts resulting data.

Error log

If an error occurs, while the script is run from the dashboard and error logging is enabled (Activate Error Logging), error message and other information is stored. Those stored errors can be found in the list view of Script Editor. If user has script write permissions, menu item Error Log will be enabled.

Error info is stored/logged only when run from dashboard. If user runs faulty script from other places like, Script Editor, Widget Editor or API, error is not stored/logged.

Error log contains includes following info:

  • Timestamp - date and time of error occurred

  • Executed By - user executing the script (shown as link if having user management permissions)

  • Script ID - identifier of a script having a run error

  • Widget ID - identifier of a widget containing the script

  • Dashboard ID - identifier of a dashboard containing the script

  • Error Text - reason why error occurred (can be copied to clipboard)

  • Dashboard URL - full dashboard URL with filters (can be copied to clipboard)

Error Log table can be filtered by entering the text in the search field in the top right corner. Search is filtering log records with entered text containing either Error Text, Dashboard URL, Script ID, Widget ID or Dashboard ID.

Table can also be sorted by clicking on column title of either Timestamp, Script ID, Widget ID, Dashboard ID, Error Text or Dashboard URL.

Error Log table shows error records of only those scripts where user has write permission to.

For example, there could be the case where user has read permissions for a script which throws error in the dashboard and user will not see error record in the error log.

Last updated