Skip to main content

Recording

Introduction

Let's explore the basic concepts of Datasets and how to use them when building applications in Data2. A Dataset is a way to access and manipulate data in a table. Let's start by understanding what Datasets are and how they work.

What are DataSets?

A Dataset is a way to access data stored in a table. On the Data² platform, DataSets are the main way of interacting with data. When we create a table and insert data into it, we can access that data through DataSets.

How to access DataSets

To access DataSets, just double-click on the background of the screen, go to the "Registry" section in the main menu, and then select the "Table" option. From there, you can create a new table and add the DataSets you want to use.

Creating a DataSet

To create a new DataSet, just select the desired table and add the fields you want to include. You can define the data type of each field, such as text, number, date, and others. You can also add constraints and validations to fields, such as minimum and maximum length, whether it's required, and others.

Exploring a DataSet's Data

Once the DataSet is created, we can explore the data using different blocks and interactions. You can create screens to view and edit the data, using blocks like DataGridBlock and DataFieldBlock. With these blocks, we can list the data in table format and allow the fields to be edited.

Saving Data

To save changes made to DataSets, we use the interactions available on it. We can insert, edit, cancel, and remove records, as well as update the DataSet with the changes made. It's important to remember to always save your changes so they're persisted to the database.

Filtering and Sorting Data

You can filter a DataSet's data to display only the records that meet certain criteria. We can create filters based on certain fields, such as displaying only active customers or only pets of type dog.

You can also sort a DataSet's data using the "sort" field. We can define ascending or descending order based on a given field, such as age, for example.

Paginating Data

If we have many records in a DataSet, we can use pagination to display data in a more organized and easier-to-navigate way. We can set the number of records per page and use interactions to navigate between pages.

Aggregating Data

Data aggregation is an advanced feature that lets us perform mathematical operations on a Dataset's records. We can calculate averages, count records, find minimum and maximum values, among other operations.

Conclusion

DataSets are a powerful tool for accessing and manipulating data in an application. They let you create tables and use different blocks and interactions to view, edit, filter, sort, and perform mathematical operations on data. With proper use of DataSets, we can build more complete, efficient applications.