- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
This shows you the differences between two versions of the page.
expression function - count distinct [2016/09/14 18:19] |
expression function - count distinct [2016/09/14 18:19] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Count Distinct (Expression Function) ====== | ||
+ | ===== Purpose ===== | ||
+ | The **Count Distinct** function (COUNT_DISTINCT) is used to count the number of unique values returned by a certain query. It does not add the values together to achieve that use the [[Expression Function - Sum|Sum]] function. If the total number of values is needed regardless of duplicates then the [[Expression Function - Count|Count]] function should be used. | ||
+ | |||
+ | {{::count_distinct_initial.png?direct&600|}} | ||
+ | |||
+ | ===== Parameters ===== | ||
+ | The **Count Distinct** function has one parameters: | ||
+ | |||
+ | ==== Field Value ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|field]] values | ||
+ | |||
+ | The parameter of the **Count Distinct** function are the field values to be counted. The input is a query built using the [[Query Builder]] to find [[Field|field]] values on one or many [[record|record(s)]] in a [[Table|table]]. | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | The output of the **Count Distinct** function is a number representing a count of all the unique values found. | ||
+ | ===== Example ===== | ||
+ | |||
+ | If an Invoice record has 4 related Line Item records, and those records have values of -6, 8, 8, and 24 in the Quantity field, COUNT(${Line Item ~> Quantity}) would result in 3. |