DataSet

Provides properties and methods to work with data on grids and views.

Available for

Model-driven and canvas apps.

Properties

columns

The set of columns available in this dataset. Supported in both model-driven and canvas apps.

Type: Column[]

error

Whether an error occurred in data retrieval. Supported in both model-driven and canvas apps.

Type: boolean

errorCode

The error code associated with the last encountered error, if applicable.

errorMessage

The error message associated with the last encountered error, if applicable.

Type: number | string

filtering

The column filtering for the current query. Supported in both model-driven and canvas apps. Filtering can be configured for a dataset by setting context.parameters.[dataset_property_name].filtering.setFilter(<filterExpression>). Once filter is set, calling context.parameters.[dataset_property_name].refresh() retrieves the filtered data from the data source.

Value Conditional operator Model-driven apps Canvas apps
-1 None Yes Yes
0 Equal Yes Yes
1 NotEqual Yes Yes
2 GreaterThan Yes Yes
3 LessThan Yes Yes
4 GreaterEqual Yes Yes
5 LessEqual Yes Yes
6 Like Yes Yes
7 NotLike No Yes
8 In Yes Yes
12 Null Yes Yes
13 NotNull No Yes
14 Yesterday Yes No
15 Today Yes No
16 Tomorrow Yes No
17 Last7Days Yes No
18 Next7Days Yes No
19 LastWeek Yes No
20 ThisWeek Yes No
22 LastMonth Yes No
23 ThisMonth Yes No
25 On Yes No
26 OnOrBefore Yes No
27 OnOrAfter Yes No
28 LastYear Yes No
29 ThisYear Yes No
33 LastXDays Yes No
34 NextXDays Yes No
37 LastXMonths Yes No
38 NextXMonths Yes No
49 Contains Yes Yes
54 BeginWith No Yes
55 DoesNotBeginWidth No Yes
56 EndsWidth No Yes
57 DesNotEndWith No Yes
70 InFiscalPeriodAndYear Yes No
75 Above Yes Yes
76 Under Yes Yes
77 NotUnder Yes Yes
78 AboveOrEqual Yes Yes
79 UnderOrEqual Yes Yes
87 ContainValues Yes Yes
88 DoesNotContainValues No Yes

Note

Filtering feature is only available to Dataverse data source.

Type: Filtering

linking

Defines the linked table information. Supported only in model-driven apps.

Type: Linking

loading

Indicates whether the dataset is loading or not. Supported in both model-driven and canvas apps.

Type: boolean

paging

Pagination status and actions. Supported in both model-driven and canvas apps. Paging info can be accessed and configured for a dataset using context.parameters.[dataset_property_name].paging .

Note

Dataverse data source does not return the totalRecordCount in paging object for canvas apps. Instead, it uses hasNextPage and hasPreviousPage to check if there are more records to be fetched.

Dataset components can use context.parameters.[dataset_property_name].paging.setPageSize(pageSize) to change the number of records retrieved per page.

Type: Paging

records

Map of IDs to the full record object. Supported in both model-driven and canvas apps.

Type: EntityRecord

sortedRecordIds

IDs of the records in the dataset, order by the query response result. Supported in both model-driven and canvas apps.

Type: string[]

sorting

The sorting status for the current query. Supported in both model-driven and canvas apps. Sorting can be configured for a dataset by setting context.parameters.[dataset_property_name].sorting = [SortStatus]. Once sorting is configured, calling context.parameters.[dataset_property_name].refresh() retrieves the sorted data from the data source.

Note

Sorting feature is only available to Dataverse data source. Also, if sorting is re-configured it will reset the filter context.parameters.[dataset_property_name].filtering

Type: SortStatus[]

Methods

Method Description Available for
addColumn Adds column to the column set. Model-driven apps
clearSelectedRecordIds Clears the selected record ids list. Model-driven and Canvas apps
delete Delete the records from data source. Canvas apps
getCommands The commands for the dataset. Canvas apps
getDataSetCapabilities The capabilities for the dataset. Canvas apps
getSelectedRecordIds Retrieves all the selected record IDs. Model-driven and Canvas apps
getTargetEntityType Returns the target table type name. Model-driven and Canvas apps
getTitle Retrieves the view display name used by the dataset property. Model-driven and Canvas apps
getViewId Returns the Id of view used by dataset parameter. Model-driven and Canvas apps
newRecord Initialize a local record object for control to set the value. The control needs to invoke the save() method on the newly created record to persist the change. Canvas apps
openDatasetItem Open dataset item for a given EntityReference. It checks if there's a command with command button ID Mscrm.OpenRecordItem. If exists, it executes the command, otherwise it just navigates to the associated form of the EntityReference. Model-driven and Canvas apps
refresh Refreshes the dataset based on filters, sorting, linking, new column. Additionally, refresh will reset paging to page 1. Model-driven and Canvas apps
retrieveRecordCommand Retrieve record's associated commands. If there are multiple datasets in the manifest, retrieveRecordCommand returns the commands for the first dataset. Model-driven
setSelectedRecordIds Set the ids of the selected records. Model-driven and Canvas apps

Lookup columns

Dataverse table's lookup columns can now be retrieved. For canvas apps, if a lookup column is included in the dataset, all columns in the referred record are retrieved. GetFormattedValue returns the JSON string for this column. GetValue method returns the JSON object directly.

Example

To learn more about how to implement the dataset methods, see DataSet Grid component

Power Apps component framework API reference
Power Apps component framework overview