Filter on Contact History Attributes: Numeric Attributes | Vantage CX - 1.4 - Filter on Contact History Attributes: Numeric Attributes - Vantage Customer Experience

Vantage Customer Experience User Guide

Vantage Customer Experience
Release Number
Release Date
June 2021
Content Type
User Guide
Publication ID
English (United States)

Example 1

-Qualify if: 
-Message 'M1' has been extended at least once
-In 'SMS' Channel
-For Message Strategy 'Recharge'
-In the last 5 days
-AND 'Score' is at least 1.2
set("extendedCH", contactHistory("response", "extended", "message", "msg1", "messageStrategy", "recharge")) &&
set("extendedOnChannel", contactHistory(extendedCH, "frequency", greaterThanOrEqual(1), "recency", "day", lessThanOrEqual(5))) &&
set("scores", contactHistory(extendedOnChannel, "attribute", "ContactHistory.sms.dcat.score")) &&
count(filter(scores, greaterThanOrEqual(1.2))) > 0
In this example, the Contact History criteria is transformed into four expressions:
  • set("extendedCH", contactHistory("response", "extended", "message", "msg1", "messageStrategy", "recharge"))
    Three filters are used here (on Response, Message, and Message Strategy) and the resulting List is placed in the variable "extendedCH".

    See Using Multiple Keyname Filters.

  • set("extendedOnChannel", contactHistory(extendedCH, "frequency", greaterThanOrEqual(1), "recency", "day", lessThanOrEqual(5)))

    This is further filtering Contact History data on Frequency and Recency values. See Filter Contact History on Frequency and Recency Values.

  • set("scores", contactHistory(extendedOnChannel, "attribute", "ContactHistory.sms.dcat.score"))
    Unlike STRING Attributes (see Filter on Contact History Attributes: STRING Attributes), the comparison value for a numeric Attribute cannot be used directly in the contactHistory expression function.
    As noted in Filter Contact History on Contact History Attributes, a Contact History Attribute in Rules expression comes in a special format. The following sub-expression retrieves all the values of the Attribute score from the already filtered Contact History List (from the result of the preceding expression, which is represented by the input variable extendedOnChannel).
    contactHistory(extendedOnChannel, "attribute", "ContactHistory.sms.dcat.score")
    The list of Attribute values is then placed into the variable scores from the set expression function: set("score"...
    This presents the main difference between filtering Contact History on Message, Response, Channel, Message Strategy, and Frequency and Recency values: These filters do not change the structure of the Contact History data. They merely filter the data, i.e., the resulting List of filtered Contact History data is a subset of the original set. With Contact History Attributes, however, the resulting List is a list of Attribute values from the Contact History data. This List can then be used in other expression functions like aggregates, DATE, TIME, string-related functions, and numeric functions.
  • count(filter(scores, greaterThanOrEqual(1.2))) > 0

    The List of Attribute values from the preceding expression, represented by the scoresvariable, is now used in filter expression function. The filter function evaluates each value in the input List against the right operator, greaterThanOrEqual, another existing expression function. Finally, the resulting List from the filter function is evaluated.