Skip to main content

list API

Overview

The final section of the SDK tutorial focuses on DcuplLists and their supplementary functionalities for querying data. The code below demonstrates a common task of applying a filter to a list of datasets and computing some aggregations.

Explanation

1) Create a list

A DcuplList is an instance of a specific model with added functionality like predefined filters and aggregations. You can initialize a list as a complete copy of the model, with fixed listItemKeys, a specific query, or based on an existing list. The list is stateful and manages the applying and removal of individual queries.

2) Apply your query

In contrast to the global query API on the dcupl class, applying a query to a list is persistent. This stateful behavior is best suited for catalog-like applications where you gradually filter a large dataset to narrow down to your desired result.

3) Calculate Aggregations

In addition to stateful queries, dcupl lists offer extra functionality that can be very useful in various applications, such as aggregations, grouped views, and calculating suggestions. Some of the aggregation outputs can be further processed by a query.many() call to obtain additional information.

4) List Metadata

ListMetadata contains a lot of useful information about the list and the underlying model, like the currentSize, initialSize, appliedQuery, and available attributes. With this information, you can easily build a dynamic UI representation of your data models, similar to what we provide in the dcupl Console.

info

Whats next?

From here on you have plenty of oportunities to choose from. Continue with one of our other tutorials, check out one of our videos or just browse the docs. Also take a look at our dcupl Console or just chat with us via our website.