Home Search

DriveWorks Pro 23
TableDistinctCount

Send Feedback

TableDistinctCount

Creates a table showing distinct values in the first column, and number of occurrences in the second.

Syntax

TableDistinctCount([Table or Table Name],[Column index],[Ignore case],[Include Header Row],[Sort Ascending]

Where:

Table or Table Name is the table to filter.

Column index is the index of the column to group and count.

Ignore case (optional) is TRUE to group entries regardless of case, FALSE to maintain case sensitivity.

Include Header Row (optional) is TRUE to include column headers, FALSE to ignore them.

Sort Ascending (optional) is TRUE to sort the results Ascending, FALSE to sort Descending.

Examples

RuleResultMeaning
TableDistinctCount(DwLookupCustomers,5,TRUE,TRUE){"Entry","Count";"Country",1;"USA",3;"United Kingdom",3;"France",1;"Germany",2;"Canada",1}Returns a table array of each entry from column 5, of the Customers table, along with the number of occurrences.
TableDistinctCount(DwLookupCustomers,5,TRUE,TRUE,TRUE){"Entry","Count";"Country",1;"France",1;"Canada",1;"Germany",2;"USA",3;"United Kingdom",3}Returns a table array of each entry from column 5, of the Customers table, along with the number of occurrences. The resulting table is sorted on the Count column values in ascending order.

Example Data

This is the Customers table that has each occurrence counted.

FirstNameSecondNameCompanyCityCountry
JeffBeachStromann Roofing LLCColumbusUSA
ThomasJacksonKing LLCSan FranciscoUSA
SamJonesCork & SonsCardiffUnited Kingdom
JulietteDoboisMarquardt PourosLyonFrance
IsabellaWemBayer WelchVelbertGermany
MartinBiddissHowell West LtdLondonUnited Kingdom
FreddieMilletonHill LtdTorontoCanada
PatrickDishmanHarber and DietrichCharlotteUSA
IvettOaksCartman GroupDumfriesUnited Kingdom
TobeHellyarSchneider ManzBerlinGermany

Example 1 Result When Viewed As A Table

EntryCount
Country1
USA3
United Kingdom3
France1
Germany2
Canada1

Example 2 Result When Viewed As A Table (Count column sorted ascending)

EntryCount
Country1
France1
Canada1
Germany2
USA3
United Kingdom3