formatted nav patterns
This commit is contained in:
parent
38a19d75d8
commit
2fad891a77
59 changed files with 1403 additions and 1970 deletions
|
|
@ -4,28 +4,23 @@ weight = 1040
|
|||
+++
|
||||
_By Bogdana Botez, at Microsoft Development Center Copenhagen_
|
||||
|
||||
### **Abstract**
|
||||
### Abstract
|
||||
|
||||
This pattern explains how to perform SELECT DISTINCT by using queries in Dynamics NAV.
|
||||
|
||||
****
|
||||
|
||||
**Description**
|
||||
|
||||
When working with tables, sometimes a developer needs to perform a SELECT DISTINCT (also known as SELECT UNIQUE) from a table. As NAV does not provide this out of the box, we present below a way to select unique records by using queries.
|
||||
|
||||
****
|
||||
|
||||
**Problem statement**
|
||||
|
||||
Let's consider the **VAT Entry** table as below: [
|
||||
][anchor0]
|
||||
Let's consider the **VAT Entry** table as below: [ ][anchor0]
|
||||
|
||||
[![ ][image0]][anchor1]
|
||||
|
||||
The goal is to select one line for each separate document that produced VAT Entries. In other words, we want records grouped by **Type, Document Type** and **Document No.**. However, if there are multiple lines with the same value of the triad **Type, Document Type** and **Document No.** in the **VAT Entry** table, we only want to see one of them.
|
||||
|
||||
#### **Solution**
|
||||
#### Solution
|
||||
|
||||
Create a new query object **VAT Entry Distinct Document No.**, with a single DataItem sourced from **VAT Entry** table. Add the three desired group-by fields **Type, Document Type** and **Document No.** as columns.
|
||||
|
||||
|
|
@ -41,7 +36,7 @@ Running the query yields a single record per document. You can notice in the sec
|
|||
|
||||
[![ ][image3]][anchor4]
|
||||
|
||||
### **Example**
|
||||
### Example
|
||||
|
||||
One thing is to be noted: there is a limitation to how much information you can take out from the records. For example, if we need to extract more information than just the one we already have in the columns, then the following apply: adding one more column of **Method Type** = **None** will indeed show more information, but it _might_ affect the grouping. More details below.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue