- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
This article describes how to use the data types array of strings, array of numbers, and array of booleans.
In this article:
Before you begin, familiarize yourself with the following:
Arrays are used to store a list of values. Whereas a string or number attribute can only contain a single value, such as "Home Page"
or 12.95
, an array can contain multiple values, such as ["Pants", "Shirts"]
or [5.99, 12.95]
. Arrays are available for the number, string, and boolean attribute data types.
In this article, arrays are represented in JSON format in all examples.
["Pants", "Shirts", "Shoes"]
[2, 4, 6]
[true, false, false]
[]
Arrays can contain duplicate values.
The array of strings attribute stores a list of text values.
The array of strings is available in the following scopes: Event, Visit, Visitor.
This enrichment adds the value of a string attribute to the array. The added attribute can only be a string, iQ variable, or omnichannel attribute.
Attribute Name: product_name
STARTING VALUE | ["Pants"] |
---|---|
ENRICHED WITH | "Shirts" |
RESULTING VALUE | ["Pants", "Shirts"] |
This enrichment adds all the values from another array to the array. The added attribute can only be an array of strings or an iQ variable.
Attribute Name: product_name
STARTING VALUE | ["Pants"] |
---|---|
ENRICHED WITH | ["Shirts", "Shoes"] |
RESULTING VALUE | ["Pants", "Shirts", "Shoes"] |
This enrichment takes two arrays as input, and returns a new array containing all values found in the first array but not the second. In this example, values from Wishlist Products
that do not also occur in Purchased Products
are added to the resulting array.
Attribute Name: Unpurchased Products
STARTING VALUE | [] |
---|---|
ENRICHED WITH |
Difference between: Wishlist Products and Purchased Products |
RESULTING VALUE | ["Shoes", "Belt"] |
This example shows that the resulting attribute value is replaced, not appended to and that repeated values in the first array are removed.
STARTING VALUE | [7, 8, 9] |
---|---|
ENRICHED WITH |
Difference between: Some Numbers and Some Other Numbers |
RESULTING VALUE | [1, 1, 2] |
This enrichment removes all values from the array.
Attribute Name: product_name
STARTING VALUE | ["Shoes", "Belt"] |
---|---|
ENRICHED WITH | |
RESULTING VALUE | [] |
This enrichment lowercases every value in the array.
Attribute Name: product_name
STARTING VALUE | ["Shoes", "BELT"] |
---|---|
ENRICHED WITH | |
RESULTING VALUE | ["shoes", "belt"] |
Sets an array of strings to a set of strings. This enrichment replaces all values in the array.
Attribute Name: Active Browser Types
STARTING VALUE | ["IE"] |
---|---|
ENRICHED WITH | ["Chrome" "FireFox", "Opera"] |
RESULTING VALUE | ["Chrome" "FireFox", "Opera"] |
Adds a set of strings to a string array. This enrichment preserves the existing values in the array, therefore there can be duplicate items in the resulting value.
Attribute Name: product_name
STARTING VALUE | ["Pants"] |
---|---|
ENRICHED WITH | ["Pants", "Shoes", "Ties"] |
RESULTING VALUE | ["Pants", "Pants", "Shoes", "Ties"] |
Specify a first, last, or all instances of a string to remove. This enrichment removes from an array every instance of the item selected for removal.
Attribute Name: product_name
STARTING VALUE | ["Pants", "Pants", "Shoes", "Ties"] |
---|---|
ENRICHED WITH | "Pants" |
RESULTING VALUE | ["Shoes", "Ties"] |
The array of numbers attribute stores a list of numeric values for browsing metrics such as visits, page views, and purchase events.
Numeric values are stored as decimals or integers. Choose the type that matches your needs:
The array of numbers is available in the following scopes: Event, Visit, Visitor.
String representations of numbers ("0", "123", "12.95") are converted to their numeric values. All other non-numeric values are ignored.
This enrichment adds a number value to the array. The added attribute can only be a number, iQ variable, or omnichannel attribute. For example, you may wish to add the last purchase value to the rolling purchase_total_history
value array.
Attribute Name: purchase_total_history
Starting Value | [12.95] |
---|---|
Enriched With | 5.99 |
Resulting Value | [12.95, 5.99] |
This enrichment adds all the values from another array to the array. The added attribute type can only be an array of numbers or iQ variable. For example, you may wish to add the array of purchased product prices to an array of all purchased product prices.
Attribute Name: purchased_products_history
Starting Value | [24.99, 12.95] |
---|---|
Enriched With | [5.99, 10.00] |
Resulting Value | [24.99, 12.95, 5.99, 10.00] |
This enrichment removes all values from the array. For example, you may wish to remove the last purchase items from the array of last purchases.
Attribute Name: purchase_total_history
Starting Value | [12.95, 5.99] |
---|---|
Resulting Value | [] |
This enrichment takes two arrays as input, looks for values that occur in one and not the other, and inserts them into the array. In this example, values from Gift Card Amounts
that do not also occur in Gift Cards Purchased
are added to the resulting array.
Attribute Name: gift_card_not_purchased
Starting Value | [] |
---|---|
Enriched With |
Difference between: and |
Resulting Value | [5.00, 10.00, 100.00, 250.00] |
The array of booleans attribute stores a list of true/false values.
The array of booleans is available in the following scopes: Event, Visit, Visitor.
The strings "true" and "false" (any mix of upper/lowercase) are converted to their respective boolean values. All other non-boolean values are ignored.
This enrichment adds a value to the array. The added attribute can only be a boolean, iQ variable, or omnichannel attribute. For example, you may wish to add a boolean to the array to represent that the customer purchased on their last visit.
Attribute Name: did_purchase_on_visit
Starting Value | [true] |
---|---|
Enriched With | false |
Resulting Value | [true, false] |
This enrichment adds all the values from another array to the array. The added attribute type can only be an array of booleans or iQ variables.
Attribute Name: my_booleans
Starting Value | [true] |
---|---|
Enriched With | [false, true] |
Resulting Value | [true, false, true] |
This enrichment removes all values from the boolean array.
Attribute Name:did_purchase_on_visit
Starting Value | [true, false, true] |
---|---|
Resulting Value | [] |
Copyright All Rights Reserved © 2008-2021