Work with your data.
In the overview screen of the script editor, you are able to access and share existing scripts or create new ones. Scripts use datasets and are used for widgets, which will then be part of dashboards. They are also used in automations. To see in which elements a script is used, click on the
on the right side of the overview screen and then on show details.
- 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 tab in the sidebar, you can add datasets and .rds or .pickle files 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).
Clicking Edit Data (3.) or Add Data in the Data tab will open a window with all the datasets you can choose from. Just select the number of rows you want to import from the dataset and add it. Once you have added a data set to your data it will be displayed in the sidebar. Click on
it to see the columns of the selected dataset. Now you should see
next to every column - click the
to add the code to your script necessary to access this column. Let's say we have a dataset called ExampleDataset with a column called Timestamp. Clicking
will add the code
if you selected R as a language and
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.
If you need to check your dataset click on
. This will take you to your dataset in the dataset builder.
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.
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.
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 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 example