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.
Overview of the Script Editor
This is where you can write our edit your script.
In the additional options, you can make a copy of your script.
Here you can edit your input data (same as in 7.) by selecting datasets.
With the Run button, you can test your script. The results will appear in a table at the bottom of your screen.
Save your script if you want to keep it.
In the General tab in the sidebar name and description can be defined as well as the used programming language.
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).
In the Results tab in the sidebar, the result variables are defined (more on that in a later section).
Select a programming language, either R or Python, to write your script with.
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.
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.