1.0 - Use Case: Using Several Attributes from a Single Complex Attribute Category - Vantage Customer Experience

Vantage Customer Experience User Guide

prodname
Vantage Customer Experience
vrm_release
1.0
category
User Guide
featnum
B035-3800-099K

A store wants to qualify the Soft_drink_offer message for customers by defining a criterion that uses several attributes from a single complex attribute category.

The complex attribute category named cart has three attributes: product, price, and discount. Each item in a customer shopping cart can have values for all of these attributes.

For this example, the cart contains these values for the attributes:
  • product: soda, potato chips, gum
  • price: $1, $0.50, $0.50
  • discount: $0.50, $0.25, $0

The Soda Offer criterion qualifies the Soft_drink_offer message for the customer only when the following is true:

(product contains 'soda’ AND the soda [price-discount] is greater than zero AND (the soda [price-discount] is greater than the ‘potato chips’ [price-discount]))

Sample Criterion Expression Syntax

The following example includes line numbers for reference that are not part of the criterion expression. Do not include line numbers when you type your criteria expressions.
001: set("cart", get("Account.cart")) &&
002: set("filterOnSoda", filter(cart, "product", "soda")) &&
003: count(filterOnSoda) > 0 &&
004: set("filterOnPotatoChip", filter(cart, "product", "potato chips")) &&
005: count(filterOnPotatoChip) > 0 &&
006: set("sodaItem", get(filterOnSoda, 0)) &&
007: set("potatoChipItem", get(filterOnPotatoChip, 0)) &&
008: set("sodaPriceDiscount", value(get(sodaItem, "price")) - value(get(sodaItem, "discount"))) &&
009: set("potatoChipDiscount", value(get(potatoChipItem, "price")) - value(get(potatoChipItem, "discount"))) &&
010: sodaPriceDiscount > potatoChipDiscount
Here is a brief explanation of what is happening in the lines of the criterion expression:
  1. Line 001 sets up the cart in a variable. The word Account refers to a complex attribute category; you must use the word Account rather than Complex.
  2. Line 002 sets a filtered view of the cart in a variable.
  3. Line 003 counts filtered soda to ensure there is at least one soda.
  4. Lines 004 and 005 are similar to 002 and 003.
  5. Lines 006 and 007 get the first item from the filtered views.
  6. Lines 008 and 009 get the priceDiscount for the test.
  7. Line 10 determines whether the soda discount is greater than the potato chip discount.