Senseforce 2.0 Manual
  • Welcome to Senseforce 2.0
  • SF MQTT API
  • SF Edge
    • Edge Package Overview
    • Edge Installation
      • Using the SF Edge Service installer in command shell
      • Headless SF Edge Servie execution
    • Edge Configuration
      • Which Plugins to load (appsettings.xml)
      • Edge Data Routing (EventDefinition.xml)
      • OTA configuration (otasettings.xml)
      • Edge Logging
      • Input plugins
        • SQL Plugin
        • SQLite Plugin
        • OPC UA Plugin
          • OPC UA server browser
        • SIEMENS S7/SINUMERIK Plugin
          • Creating connection definition file
        • S7 Plugin
        • REST Plugin
        • TCP Listener Plugin
        • XML File Parsing Plugin
        • Heidenhain Plugin
      • Output Plugins
        • MQTT Plugin
        • SQLite Plugin
    • Edge Compute plugins
      • Creating compute plugins
      • Using compute plugins
  • SF Edge Asset Management
    • Edge version repository
  • SF Platform
    • Navigation
      • Overview Screen
    • Dataset Builder
      • Filters, Aggregations and Groupings
      • Functions of the Formula Editor
      • Additional Settings
      • Special Events
      • FAQ and Troubleshooting
    • Script Editor
      • Details of the Script Editor
      • Installed Packages
      • Working with Timestamps
        • Working with Timestamps in Python
        • Working with Timestamps in R
      • FAQ and Troubleshooting
    • Widgets
      • Text
      • Headline
      • Image
      • Progress Bar & Gauge Chart
      • Table
      • Map
      • Line, Bar, Scatter and Area Chart
      • Pie Chart
      • Gantt Chart
      • Histogram
      • Overview
      • Log
      • Default colors and color conditions
      • FAQ and Troubleshooting
    • Dashboards
      • Dashboard Filters
      • Favorites
      • Data Drilldown & Widget Interaction
      • Editing multiple dashboard widgets
      • Time Zones
      • Synchronized Zooming
      • Sharable Dashboard URL
      • Multi-chart layout options
      • Default sort for table widgets
      • Releases
      • Reporting
      • FAQ and Troubleshooting
      • Applying zoom to global timestamp filter
      • Optimise the layout for different devices
    • Machine Master Data
      • Dimensions
      • Instances
      • Things
      • Use Case
      • FAQ and Troubleshooting
    • Automation
      • Trigger
      • Scheduling overview
      • Actions
      • Test your Automation
      • Zapier integration (necessary internal steps)
      • Zapier integration
      • Subscriptions
      • FAQ and Troubleshooting
    • Event Schema Management
      • Importing a Event Schema
      • FAQ and Troubleshooting
    • Virtual Events
      • Creating a Virtual Event
      • Scheduling Overview
      • Permissions and Data Access
      • FAQ and Troubleshooting
    • Details modal for elements
    • Copy / Duplicate elements
    • Whitelabeling
    • Edge Device Management
    • Element History
    • Public API
      • Get your access token
      • Endpoints
      • Debugging scripts
      • FAQ and Troubleshooting
    • User & Group Management
      • FAQ and Troubleshooting
    • Active Directory & SSO Setup
Powered by GitBook
On this page
  • Overview of the Script Editor
  • Input Data
  • Results
  • Executing a script (Run)
  • Error log

Was this helpful?

  1. SF Platform

Script Editor

Work with your data.

PreviousFAQ and TroubleshootingNextDetails of the Script Editor

Last updated 2 years ago

Was this helpful?

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

  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.

After you've added datasets or scripts, they will be displayed in the corresponding sidebar tab in tree view. Next to every dataset or script, you will be able to click on the icon to see the columns/results of the selected dataset/script. Next to every column/result you should see a icon - clicking it will add the code to your script necessary to access this column.

For example, let's say we have a dataset called ExampleDataset with a column called Timestamp. Clicking will add the code

If you need to check your dataset or your script click on . This will take you either to the dataset in the dataset builder or the script in the script editor.

Error log example