Virtual Dataset
# Virtual Dataset
Virtual Dataset allows you to bind a Dataset Base Control to a field while providing your own custom Data Source. We currently have two Data Providers - Memory and FetchXml. Memory Provider allows you to work with a collection of data that you have stored in memory and FetchXml Provider allows you to do the same thing with data retrieved through FetchXml. Both of these providers support basic Dataset features, which include:
- Sorting
- Filtering
- Paging
- Editing
- Quick Find
NOTE: Due to a bug in Power Apps maker, this PCF can only be bind manually through Form Xml!
# Data Providers
Static binding allows you to choose between two providers - FetchXml and Memory. After you select a provider, you need to specify it's Data Source through additional static binding.
# FetchXml Data Provider
FetchXml provider expects a valid FetchXml string as Data Source.
# Memory Data Provider
Memory Data Provider expects a stringified JSON array as input. The array should contain key-value pairs consisting of column name and it's value. This is the exact same structure you would see in a raw OData response. This means OptionSets are represented by a number, lookups have GUIDs and etc. This applies to each data type. If you are not sure what value should be used for a specific Data Type, run an OData query against some entity containing fields of this data type and see what you get back.
OData response Example
{
"@odata.context":"https://devbox-1959.crm4.dynamics.com/api/data/v9.1/$metadata#talxis_fields",
"value":[
{
"@odata.etag":"W/\"4363703\"",
"talxis_file_name":null,
"_owninguser_value":"e86450b3-5882-ef11-ac20-000d3abee5ab",
"talxis_clientextensibilitydatasource":null,
"talxis_singlelinetext":"Text",
"talxis_clientextensibilitybindingfield":null,
"talxis_name":"Batch 1",
"talxis_dateandtime":"1972-01-15T00:00:00Z",
"_transactioncurrencyid_value":"13292e9f-7881-ef11-ac21-000d3a2b5e17",
"talxis_clientextensibilitymetadata":null,
"exchangerate":1,
"talxis_currency_base":998472,
"talxis_singlelineemail":"test@test.cz",
"versionnumber":4363703,
"talxis_file":null,
"talxis_singlelineurl":"https://www.seznam.cz",
"talxis_image":null,
"talxis_multiple":"Multiple Text",
"statecode":0,
"talxis_image_timestamp":null,
"talxis_wholeduration":710135,
"talxis_twooptions":true,
"_createdonbehalfby_value":null,
"utcconversiontimezonecode":null,
"statuscode":1,
"talxis_multiselectoptionsetcolorful":"742070000,742070001",
"talxis_fetchxmlbindingfield":null,
"talxis_memorybindingfield":null,
"talxis_clientextensibilitycolumns":null,
"talxis_optionsetcolorful":742070000,
"modifiedon":"2024-10-12T10:34:53Z",
"talxis_wholenone":991020,
"talxis_image_url":null,
"talxis_fetchxmldata":null,
"_ownerid_value":"e86450b3-5882-ef11-ac20-000d3abee5ab",
"talxis_fieldid":"6c9e8489-1086-ef11-ac21-6045bd91c897",
"_owningteam_value":null,
"_modifiedonbehalfby_value":null,
"createdon":"2024-10-09T07:31:46Z",
"talxis_twooptionscolorful":false,
"talxis_imageid":null,
"_owningbusinessunit_value":"551c1778-4881-ef11-ac21-000d3a2b5e17",
"timezoneruleversionnumber":0,
"talxis_dateandtimetzi":null,
"talxis_multiselectoptionset":"742070000,742070001",
"talxis_fetchxmlcolumns":null,
"_createdby_value":"e86450b3-5882-ef11-ac20-000d3abee5ab",
"talxis_fetchxmlentitymetadata":null,
"talxis_singlelinephone":"123456789",
"talxis_dateonly":"1968-09-02T00:00:00Z",
"_talxis_parentfield_value":"ac6aa5c8-4086-ef11-ac21-000d3abee5ab",
"_modifiedby_value":"e86450b3-5882-ef11-ac20-000d3abee5ab",
"overriddencreatedon":null,
"importsequencenumber":null,
"talxis_decimal":2000000,
"talxis_currency":998472,
"talxis_memorydata":null,
"talxis_optionset":742070000,
"talxis_memorycolumns":null,
"talxis_memoryentitymetadata":null
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
NOTE: You always need to include the @OData and @Microsoft fields for lookups. You should not do that for any other Data Types (dates, optionsets etc.), we calculate these values on client automatically
# Columns
Columns binding can be used to specify metadata for each column. It expects a stringified JSON array containing objects of column metadata. This object is based on the PCF Dataset Column interface (opens new window). If you do not specify metadata for a column, it will not be visible in the UI.
Example Columns Definition
[
{
"name": "datetime",
"alias": "datetime",
"dataType": "DateAndTime.DateAndTime",
"displayName": "Date Time",
"order": 0,
"visualSizeFactor": 300
},
{
"name": "mail",
"alias": "mail",
"dataType": "SingleLine.Email",
"displayName": "Mail",
"order": 1,
"visualSizeFactor": 300,
"metadata": {
"IsValidForUpdate": true
}
},
{
"name": "lookup",
"alias": "lookup",
"dataType": "Lookup.Simple",
"displayName": "Lookup",
"order": 2,
"visualSizeFactor": 300,
"metadata": {
"Targets": ["customLookup"]
}
},
{
"name": "optionset",
"alias": "optionset",
"dataType": "OptionSet",
"displayName": "OptionSet",
"order": 3,
"visualSizeFactor": 300,
"metadata": {
"OptionSet": [
{
"Color": "red",
"Label": "Option 1",
"Value": 1
},
{
"Color": "blue",
"Label": "Option 2",
"Value": 2
}
]
}
}
]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
The PCF Dataset Column interface (opens new window) has also been extended with a metadata
prop. This allows you to define/override Xrm Attribute Metadata (opens new window) for each column. For example, you can see that we are setting Options for OptionSets in our example through metadata
prop. That way, the provider will know what Label to use if we would request formatted value for that column.
Depending on which provider you choose, a different minimal amount of props is required for the column to show in the UI:
- FetchXml Provider:
name
- Memory Provider:
name
,displayName
anddataType
(opens new window)
You can also specify virtual columns by ending the column name with __virtual
suffix. This will let the provider know that it should not try to fetch any metadata for the column and it is up to you to specify them. You can then perform actions (setValue
, getValue
) on this column, just like on the classic one.
# Entity Metadata
Entity Metadata binding allows you to define/override any Xrm Entity Metadata (opens new window). For example, you can change the DisplayCollectionName
, so the UI can better describe your dataset. For Memory Provider, it is required to specify the PrimaryIdAttribute
prop. The binding accepts a stringified JSON object that corresponts to the Xrm Entity Metadata (opens new window) interface.
# Bindings Summary
Property Name | Description | Of Type | Input | Output | Usage | Required |
---|---|---|---|---|---|---|
bindingField | Binding Field | SingleLine.Text | N/A | N/A | bound | true |
DataProvider | Data Provider that the control will use to fetch data. | Enum ("Memory" | "FetchXml") | "FetchXml" | N/A | input | true |
Data | Data Source depending on the provider (FetchXml for FetchXml Provider, JSON array for Memory Provider). | Multiple | "<fetch><entity name="account"><attribute name="name"/></entity></fetch>" | N/A | input | true |
Columns | JSON array containing the column definitions. | Multiple | [{"name": "name", "isHidden": false}] | N/A | input | true |
Entity Metadata | Optional property allowing you to override/define Entity Metadata | Multiple | {"DisplayCollectionName": "Custom Collection Name"} | N/A | input | false |
Height | Can be used to force the control to always stay at fixed height. | SingleLine.Text | 500px | N/A | input | false |
EnableEditing | Enable or disable editing functionality in the control. | Enum ("Yes" | "No") | "Yes" | N/A | input | false |
EnablePagination | Enable or disable pagination in the control. | Enum ("Yes" | "No") | "Yes" | N/A | input | false |
EnableFiltering | Enable or disable filtering options in the control. | Enum ("Yes" | "No") | "Yes" | N/A | input | false |
EnableSorting | Enable or disable sorting options in the control. | Enum ("Yes" | "No") | "Yes" | N/A | input | false |
EnableNavigation | Enable or disable navigation options in the control. | Enum ("Yes" | "No") | "Yes" | N/A | input | false |
EnableOptionSetColors | Enable or disable OptionSet colors in the control. | Enum ("Yes" | "No") | "No" | N/A | input | false |
SelectableRows | Defines if and how rows can be selected. | Enum ("None" | "Single" | "Multiple") | "Single" | N/A | input | false |
EnableQuickFind | Enable or disable the Quick Find feature in the control. | Enum ("Yes" | "No") | "No" | N/A | input | false |
NOTE: You can quickly demo the control locally through PCF local harness (opens new window). Just make sure you switch the
_mock
variabletrue
.