Functions on datasets

This article describes some of the functions you can perform on datasets. All these functions can also be found in the Finder. For convenience, we split this section in the general and more advanced functions. If you do not know how formulas and/or functions work, please see introduction to formulas and introduction to functions from the guided tour or formulas for extra explanation.

General functions


If, in any case, you need a subset of your dataset, you can use select(). For example, say you have a dataset of all employees called ds_employees and you want to know which employees earn more than €30.000,- each year. You can use select in the following way (with a formula):

select(ds_employees, > 30000)

Note that doing this will change the original dataset! If you need to have both the complete and the subset of your data, please make a copy of you dataset first. You can do this in the following way:

ds_employees_selected := ds_employees
select(ds_employees_selected, > 30000)


If you need to sort your dataset, you can use the sort() function. This can be useful if you need to show it to you users or are ask a question based on it. Sorting is really simple: just use sort() with both the dataset you want to sort and the value you want to sort on. For example, I want to sort my employee dataset ds_employees based on their salary:

sort(ds_employees, '')

That’s it! This works both for numbers and text. Just remember to make a copy if you want to keep the original order as well.


Count() is a really easy function that allows you to check to amount of iterations (‘rows’ in simple datasets). So, say you let your end user fill in some forms and make a dataset with it through graphtodataset() (see Advanced Functions). Now, you want to know how many forms he or she filled in. To so, simply use count(ds_forms)!

Deleterow() and copyrows

Both functions here are quite handy when working with datasets, but they work slightly different. Both functions require a dataset, one or two numbers and will return another, edited dataset. The difference is that deleterow() will return a dataset with some row removed, while copyrows() will return a dataset with those rows only. Furthermore, if you want to select more than one row (with either deleterows() or copyrows()) you need to specify a range. For example, ds_new := deleterows(ds_employees, 0, 3) will remove the first four rows of the dataset (counting starts at zero!). Some other examples:

ds_deleted := deleterow(ds_employees, 4)
ds_deleted := deleterows(ds_employees, 0, 6)
ds_copied := copyrows(ds_employees, 0, 5)


graphtodataset() is a very useful function that is used to convert (iterations of) graphs into a single dataset. An example on how it’s used can be found at datasets as input types. The general idea is that you repeatedly call a graph, after which you put all that information in a dataset. For example, consider a graph in which the end user enters data on his employees. Each time he or she is finished with someone, a new one can be entered. After that, you may want to present to user with that information in a table. So you use graphtodataset() to covert the iterations of the graph into a dataset:

ds_employees := graphtodataset(g_employee_data)

Advanced functions

The following functions are quite complicated to use and might not be very intuitive for new or even experienced users of the Berkeley Studio. We recommend a good understanding of datasets, functions and graphs. If you want to use one of these functions but don’t understand how they work, feel free to contact us.


If you have two datasets of the same type, concatdatasets() will merge the together into a single dataset. The functions gives you a new dataset, which is a combination of the other two. For example,

ds_combined := concatdatasets(ds_employees_old, ds_employees_new)

Will create the new dataset ds_combined that has both the values of ds_employees_old and ds_employees_new.


purgedataset() is a relatively technical function that removes data from a dataset that is no longer needed. For example, whenever you use the select() function, the elements that are not selected will still be in the dataset, but are made ‘invisible’. What purgedataset() does is removing those completely, thus freeing up space and possibly making your model faster.

Just like a lot of other functions on datasets, purgedataset() creates a new dataset. So, say you want to (permanently) remove some elements completely from your employee dataset, the following formulae would do the trick:

ds_employees := select(ds_employees, ds_employees.salaray > 10000)
ds_employees := purgedataset(ds_employees)