Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

getDistinctValuesCount

Queries all distinct values of an attribute and counts the recipients for each value in Optimizely Campaign.

You can replace this method by the .NET replacement method getDistinctValuesCountFlat.

🚧

Caution

Using this method with the wrong argument (e.g., no threshold) can lead to huge amount of data returned.

Type: String[ ] [ ]

Parameters

NameTypeValue
sessionIdStringID of the session
recipientListIdlongID of the recipient list
recipientFilterIdlong(optional) ID of the target group

If the value is greater than 0, only recipients that match the target group with this ID are returned.
attributeNameStringField name of the field (e.g., firstname, lastname etc.) that is to be queried for distinct values
thresholdintNumber of characters that are examined

Example: With a threshold of 4 the values Test-A and Test-B will be summed up to Test.

Return values

Multidimensional arrays. Odd indices contain the value and even indices contain the corresponding count

Example: result[0][0]=="Value 1", result[0][1]=="234", result[1][0]=="Value 2", result[1][1]=="678"

📘

Note

A maximum of 10,000 values are returned.

Code structure

String[][] getDistinctValuesCount(String sessionId, long recipientListId, long recipientFilterId, String attributeName, int threshold)