With streaming datasets, you can stream the data in real-time for quick data analysis and visualization. They are also known as real-time datasets. You can use any visual in a dashboard to display real-time data.
Streaming datasets store the data in a temporary cache which expires as per the retention time set by the user. The main usage of a streaming dataset is to receive the data from the IoT devices, sensors, or other system's event data. Unlike direct and COT datasets, there are no data sources, relationships, fields, filters, parameters, and options for the streaming datasets. Therefore, there is no scope to add filters or groups to a streaming dataset. For more information on streaming datasets, go through the following sections.
Streaming datasets can be used in both reports and dashboards.
Use the below steps to create a streaming dataset on the Resource Portal.
On the Resource Portal, navigate to the Create tab and then select Prepare Data for the dashboard.
To create a streaming dataset for the dashboard, click the Create button as shown.
The Streaming Dataset Designer window that appears, fill in the following information for the field -
Note: Streaming dataset must contain at least one field.
You can add more fields to the dataset using the + Add Field button as shown.
Enter a valid string with a maximum length of 20 characters in the Push Data Token, or click the Random Generate button to generate a random data token. If you want only an authorized user should insert the data in a streaming dataset, the value of the Push Data Token must be specified.Once the Push Data Token is set, you must add this token in the endpoint URL to add data.
Set the Retention Time to a suitable amount of time. The retention time determines how long the data will be stored in the memory. By default, the retention for the streaming dataset is set to 15 minutes. You cannot set the retention time to less than a minute or beyond 60 minutes.
Note: When the data passes the specified retention time, it is cleared from the memory.
Use the below steps to save a streaming dataset on the Resource portal.
Click the Save button to save the streaming dataset. The dataset is now ready to be bound to dashboards.
In the Save dialog box that appears, enter the dataset name, assign a category, and add a comment (if any) as shown.
You can view the added dataset under the specified category in the Category tab of the Resource Portal.
Currently, the streaming dataset only defines the table structure. You can preview the dataset to view the table structure.
Since no data is inserted into the dataset, there are no rows added to the dataset. For more information on how to push data, see the below section.
Use the below steps to push data to the dataset on the Resource portal. In order to push data, you must specify the Push Data Token while creating the dataset. Push Data Token is a valid string with a maximum length of 20 characters. You must add this token in the endpoint URL to insert the data in a streaming dataset. This will make sure that only authorized users are able to add the data to the streaming dataset.
Also, the only way to insert data into the streaming dataset, is through API (JSON). In the below steps, we have used Postman, a great tool for sending API requests, for pushing the data to the dataset.
On the Resource portal, go to Document Types > Dataset.
Select the streaming dataset in which you want to insert the data.
Click the More button and then select the Endpoint Information option from the list.
A Push Data Endpoint Information dialog box appears that provides information about the API request to insert data in the dataset such as End Point, Request body, and Information.
Copy the End Point from the Push Data Endpoint Information dialog box into the URL box of the Postman.
Change the method type to 'POST'.
In the Body tab of Postman, set the type to 'raw', and then specify the format as 'JSON'.
Copy the Request body from the Push Data Endpoint Information dialog box into the body area of the Postman.
The columns in the request body represent the names of the fields, while the rows represent the content of the fields. You can set overwrite to 'true' to overwrite the previous content, or 'false' to add the new content to the previous one.
The below example uses the default values.
If you want to add multiple rows, use an array as shown below.
Now, click the Send button. You will see a success message on the successful addition of the data.
Preview the dataset to see the newly added data.
Editing a dataset includes adding new fields to the dataset, modifying or deleting the existing field names or types, changing the retention time, and more. Use the below steps to edit a streaming dataset.
Note: Existing data is lost on editing a streaming dataset.
On the Resource Portal, go to Document Types > Dataset.
Select the streaming dataset that you want to edit.
Click the More button and then select Edit from the list.
In the Streaming Dataset Designer window that appears, you can now edit the dataset. For example, you can click the Delete button to delete an existing field.
Once you finish modifying the dataset, click the Save button to save the changes.