Skip to content

Commit e6ab80c

Browse files
committed
Merge branch 'master' into Nava_charts
2 parents e6a8b37 + 7072aaa commit e6ab80c

File tree

335 files changed

+4023
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

335 files changed

+4023
-290
lines changed

powerapps-docs/developer/common-data-service/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
href: use-fetchxml-left-outer-join-query-records-not-in.md
2828
- name: Page large result sets with FetchXML
2929
href: org-service/page-large-result-sets-with-fetchxml.md
30+
- name: Paging behaviors and ordering
31+
href: org-service/paging-behaviors-and-ordering.md
32+
- name: Use column comparison in queries
33+
href: column-comparison.md
3034
- name: "Use SQL to query data (Preview)"
3135
href: cds-sql-query.md
3236
- name: Saved Queries

powerapps-docs/developer/common-data-service/authenticate-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Use OAuth with Common Data Service (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Learn how to authenticate using OAuth with Common Data Service" # 115-145 characters including spaces. This abstract displays in the search result.
4-
ms.custom: ""
4+
ms.custom: has-adal-ref
55
ms.date: 10/31/2018
66
ms.reviewer: "pehecke"
77
ms.service: powerapps

powerapps-docs/developer/common-data-service/build-web-applications-server-server-s2s-authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ S2S authentication means you don’t need to use a paid Power Apps user license
3232
| Scenario | Description |
3333
|---------------|---------------|
3434
| Multi-Tenant | This is the most common scenario and the one which is used for apps distributed using Microsoft AppSource.<br /><br /> Each Common Data Service tenant is associated with an Azure AD tenant. Your web application or service is registered with your Azure AD tenant.<br /><br /> In this scenario any Common Data Service tenant can potentially use your multi-tenant application after they grant consent for the application to access data in their tenant. |
35-
| Single-Tenant | This scenario typically applies to Common Data Service environments that want to develop apps for their own tenant and don’t intend to distribute them to other [Common Data Service environments.<br /><br /> An enterprise can create a web application or service to connect to all the Common Data Service environments for their tenant.<br /><br /> In this scenario, your web application or service will only be able to connect to Common Data Service environments using the same Azure AD tenant. |
35+
| Single-Tenant | This scenario typically applies to Common Data Service environments that want to develop apps for their own tenant and don’t intend to distribute them to other Common Data Service environments.<br /><br /> An enterprise can create a web application or service to connect to all the Common Data Service environments for their tenant.<br /><br /> In this scenario, your web application or service will only be able to connect to Common Data Service environments using the same Azure AD tenant. |
3636

3737
Both scenarios have common elements but there are some differences. Since multi-tenant is the most common scenario, the [Use Multi-Tenant Server-to-server authentication](use-multi-tenant-server-server-authentication.md) content describes how you can use S2S in this scenario and include notes where the options for single-tenant configuration is different.
3838

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: "Use column comparison in queries (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3+
description: "Learn how to compare columns when querying business data." # 115-145 characters including spaces. This abstract displays in the search result.
4+
ms.custom: ""
5+
ms.date: 07/08/2020
6+
ms.reviewer: "pehecke"
7+
ms.service: powerapps
8+
ms.topic: "article"
9+
author: "NHelgren" # GitHub ID
10+
ms.author: "nhelgren" # MSFT alias of Microsoft employees only
11+
manager: "mayadu" # MSFT alias of manager or PM counterpart
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
19+
# Use column comparison in queries
20+
21+
In the Common Data Service, users can perform a column comparison for the
22+
following condition operators using FetchXML, Web API, or the SDK API:
23+
24+
- Equal
25+
- NotEqual
26+
- GreaterThan
27+
- GreaterEqual
28+
- LessThan
29+
- LessEqual
30+
31+
This will allow the comparison of an attribute against a specific value and
32+
return all found records, or allow the comparison of two attributes to return
33+
all records with a matching value.
34+
35+
## Limitations
36+
37+
Listed below are the limitations for the current Common Data Service column comparison support.
38+
39+
- You can only compare columns within a single entity
40+
- Only two columns may be compared at a time.
41+
- Multi-value condition operators are not supported (i.e., "in").
42+
- Extended condition operators are not supported (i.e., "creditlimit \> spends+1000").
43+
- Incompatible attribute comparison is not supported. For example, "int vs. int" attributes is a valid comparison but "int vs. string" attributes is not a valid comparison.
44+
45+
## Column comparison using FetchXML
46+
47+
The following example shows how to compare columns using FetchXML:
48+
49+
```xml
50+
<fetch>
51+
<entity name='contact' >
52+
<attribute name='firstname' />
53+
<filter>
54+
<condition attribute='firstname' operator='eq' valueof='lastname'/>
55+
</filter>
56+
</entity>
57+
</fetch>
58+
```
59+
60+
For FetchXML requests, a new node `valueof` has been added inside the condition
61+
node. The `valueof` tag is used to identify the attribute that is being compared
62+
to the selected attribute. In the above example, the 'firstname' column is being
63+
compared against the 'lastname' column and will return any records that contain
64+
the same value across both attributes.
65+
66+
### See Also
67+
68+
[Use FetchXML to construct a query](use-fetchxml-construct-query.md)
69+
[Column comparison using the Web API](webapi/query-data-web-api.md#column-comparison-using-the-web-api)
70+
[Column comparison using the SDK API](org-service/use-conditionexpression-class.md#column-comparison-using-the-sdk-api)

powerapps-docs/developer/common-data-service/file-attributes.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "File attributes (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
33
description: "Learn about File attributes that store file data within the application, supporting attributes, retrieving data, and uploading file data." # 115-145 characters including spaces. This abstract displays in the search result.
44
ms.custom: ""
5-
ms.date: 06/17/2020
5+
ms.date: 07/09/2020
66
ms.reviewer: "pehecke"
77
ms.service: powerapps
88
ms.topic: "article"
@@ -150,6 +150,18 @@ Headers:
150150
x-ms-transfer-mode: chunked
151151
x-ms-file-name: sample.png
152152
```
153+
154+
**Request** (alternate form)
155+
156+
This form of the request uses a query string parameter and supports non-ASCII language file names. If the file name is specified in both the header and as a query string parameter, the header value has precedence.
157+
158+
```http
159+
PATCH [Organization URI]/api/data/v9.1/accounts(id)/myfileattribute?x-ms-file-name=测试.txt
160+
161+
Headers:
162+
x-ms-transfer-mode: chunked
163+
```
164+
153165
**Response**
154166
```http
155167
200 OK

powerapps-docs/developer/common-data-service/org-service/page-large-result-sets-with-fetchxml.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ while (true)
108108
}
109109
```
110110

111-
### See also
111+
### See also
112+
113+
[Paging behaviors and ordering](paging-behaviors-and-ordering.md)
112114
[Sample: Use FetchXML with a Paging Cookie](samples/use-fetchxml-paging-cookie.md)
113115
[Building Queries with FetchXML](/dynamics365/customer-engagement/developer/org-service/build-queries-fetchxml)
114116
[Fiscal date and older than datetime query operators in FetchXML](../use-fetchxml-fiscal-date-older-datetime-query-operators.md)
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
title: "Paging behaviors and ordering (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
3+
description: "Learn about the different paging behaviors for FetchXML queries and how you can write queries to get the desired paging results." # 115-145 characters including spaces. This abstract displays in the search result.
4+
ms.custom: ""
5+
ms.date: 7/20/2020
6+
ms.reviewer: "pehecke"
7+
ms.service: powerapps
8+
ms.topic: "article"
9+
author: "NHelgren" # GitHub ID
10+
ms.author: "nhelgren" # MSFT alias of Microsoft employees only
11+
manager: "mayadu" # MSFT alias of manager or PM counterpart
12+
search.audienceType:
13+
- developer
14+
search.app:
15+
- PowerApps
16+
- D365CE
17+
---
18+
19+
# Paging behaviors and ordering
20+
21+
When querying data using FetchXML, paging query results can make viewing large
22+
volumes of information easier. It is important when using paging to include
23+
ordering parameters as well. Without proper ordering, paging requests for the
24+
“next 50” records can result in retrieving the same records across multiple
25+
pages making reviews and edits much more difficult. Proper page ordering
26+
requires including unique values to help identify which records are included in
27+
a page.
28+
29+
## Legacy paging
30+
31+
Legacy paging within the Common Data Service loads all the results of the query
32+
up to the current page into memory on the server, selects the number of records
33+
that are needed for the page, and then ignores the rest. This has benefits such
34+
as quick back/forward paging through the data or skipping to a specific page,
35+
but it also has restrictions such as a 50K row limit, performance issues with
36+
large complex queries, and arbitrarily sorted distinct query results.
37+
38+
## Ordering with a paging cookie
39+
40+
When paging with ordering, a cache of the previous page’s results is stored in a
41+
paging cookie. This is used to calculate what the next page of data should
42+
display.
43+
44+
If a user does not specify any “order by” parameters, the system will
45+
automatically insert “order by "\<\<entity name\>\>".\<\<entityId\>\> asc” to
46+
provide some basic ordering. Depending on the data that is being queried, this
47+
may result in inadequate and unexpected results as a single system user can be
48+
associated with multiple records within any query.
49+
50+
If distinct FetchXML queries are being used, the system will not add any
51+
additional ordering due to potential impacts to the data returned. In these
52+
cases, users will have to add at least a single ordering value for a more
53+
consistent paging experience.
54+
55+
> [!NOTE]
56+
> Paging using FetchXML for Common Data Service is dynamic. The page a
57+
> record appears on is determined at the time that each page is rendered. If 1000
58+
> records are being displayed 50 to a page, the first 50 records are displayed as
59+
> page one. When page two is requested, the system determines what the next 50
60+
> records should be at the time of request. Because of this, it would not be
61+
> possible to use the new paging functionality for back paging. Legacy behavior is
62+
> used for back paging which will have reduced performance and any returns after
63+
> page 500 cannot be “paged back” due to legacy limitations. 
64+
65+
### Why ordering is important
66+
67+
If a query is run to retrieve all records with a state of “Open” this could
68+
result in 1000 returns. When paging from page one to page two, there is no way
69+
for the system to know which orders to display on page two because all of the
70+
records have the same state. The paging of these records will not be efficient
71+
or consistent.
72+
73+
Providing an “order by” value gives the paging cookie the ability to order the
74+
data by an additional value and recognize the last record in a page based on the
75+
values provided.
76+
77+
#### Example 1
78+
79+
A query is created to get all records with a state of ‘Open’, include the status
80+
for every record, and show three records per page. The query is then ordered by
81+
status. The query result would page as shown in the following table:
82+
83+
| State | Status | Page |
84+
|-----------|------------|---------------|
85+
| Open | Active | 1 |
86+
| Open | Active | 1 |
87+
| Open | Active | End of page 1 |
88+
| Open | Active | |
89+
| Open | Active | |
90+
| Open | Inactive | |
91+
| Open | Inactive | |
92+
93+
The paging cookie will save information about the last record on the page, but
94+
when it’s time to get page two in this example, there is no unique identifier to
95+
ensure that the next page populated uses the unviewed records or include the
96+
first two records that were on page one.
97+
98+
To solve this problem, queries should include “order by” columns that have
99+
unique values. It is possible to use multiple “order by” values. Below is a
100+
better way to order data for this query:
101+
102+
#### Example 2
103+
104+
A query is created to get all records of a state of ‘Open’, any status, include
105+
the Case IDs, and show three records per page. It orders by status and by Case
106+
ID (a unique identifier) which will order in ascending order. The query result
107+
would page the results as shown below:
108+
109+
| State | Status | Case ID | Page |
110+
|-----------|------------|-------------|---------------|
111+
| Open | Active | Case-0010 | 1 |
112+
| Open | Active | Case-0021 | 1 |
113+
| Open | Active | Case-0032 | End of Page 1 |
114+
| Open | Active | Case-0034 | |
115+
| Open | Active | Case-0070 | |
116+
| Open | Inactive | Case-0015 | |
117+
| Open | Inactive | Case-0047 | |
118+
119+
The query results are first ordered by the Status, and then ordered by the Case
120+
ID in ascending order. When page two is generated, the result would be as shown
121+
below:
122+
123+
| State | Status | Case ID | Page |
124+
|-----------|------------|-------------|---------------|
125+
| Open | Active | Case-0010 | |
126+
| Open | Active | Case-0021 | |
127+
| Open | Active | Case-0032 | End of Page 1 |
128+
| Open | Active | Case-0034 | 2 |
129+
| Open | Active | Case-0070 | 2 |
130+
| Open | Inactive | Case-0015 | |
131+
| Open | Inactive | Case-0047 | |
132+
133+
When generating page two of this query set, the cookie will have Case-0032
134+
stored as the last record in the first page, so page two will pick up at the
135+
next record in the set after that record. This will allow for more consistent
136+
results.
137+
138+
### Ordering suggestions
139+
140+
Listed below are some suggestions for improving ordering of paging results, along with some areas to avoid.
141+
142+
#### Best ordering
143+
144+
- Always include a column that has a unique identifier (i.e., entity ID
145+
columns, auto-number columns, user/contact IDs)
146+
147+
#### Good ordering
148+
149+
- Include multiple fields that will most likely result in unique combinations:
150+
- First name + last name + email address
151+
- Full name + email address
152+
- Email address + company name
153+
154+
#### Poor ordering
155+
156+
- Orders that do not include unique identifiers
157+
158+
- Orders that have single or multiple fields that are not likely to provide
159+
uniqueness such as:
160+
- Status and state
161+
- Option sets or booleans
162+
- Name values by themselves (i.e., last only, first only, company name
163+
only)
164+
- Text fields like titles, descriptions, multi-line text
165+
- Non unique number fields
166+
167+
### Ordering and multiple entity queries
168+
169+
Sometimes data is needed that spans multiple entities and must be queried with a
170+
table JOIN. In these cases, ordering can be included for both entities in the
171+
query. Make sure to use at least one column with a unique ID per entity to
172+
ensure the paging provides the best results. However, the query will be
173+
downgraded to legacy paging, where no paging cookie will be returned, in these
174+
cases due to limitations of the N:1 relationship structure that could result in
175+
missing data.
176+
177+
### See Also
178+
179+
[Page large result sets with FetchXML](page-large-result-sets-with-fetchxml.md)

powerapps-docs/developer/common-data-service/org-service/use-conditionexpression-class.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,41 @@ condition3.Operator = ConditionOperator.Equal;
8282
condition3.Values.Add(AccountState.Active);
8383

8484
```
85-
85+
86+
## Column comparison using the SDK API
87+
88+
The following example shows how to compare columns using SDK API and the Organization service:
89+
90+
```csharp
91+
public ConditionExpression
92+
(
93+
string attributeName,
94+
  ConditionOperator conditionOperator,
95+
  bool compareColumns,
96+
  object value
97+
)
98+
99+
public ConditionExpression
100+
(
101+
string attributeName,
102+
ConditionOperator conditionOperator,
103+
  bool compareColumns,
104+
  object[] values
105+
)
106+
```
107+
108+
In the SDK, two APIs are introduced to support column comparison. The
109+
first identifies the original attribute, the second allows
110+
for the inclusion of the attribute you want to compare it against.
111+
112+
If `compareColumns` is passed in as `true`, it will compare the two attributes
113+
and return all records that match.
114+
115+
If a `false` value is passed, it will return all records for one attribute and
116+
return values that match the provided value.
117+
118+
More information: [Use column comparison in queries](../column-comparison.md)
119+
86120
### See also
87121
[Building Queries](build-queries-with-queryexpression.md)
88122
[Build Queries with QueryExpression](build-queries-with-queryexpression.md)

0 commit comments

Comments
 (0)