Back

This article describes how to use the data types array of strings, array of numbers, and array of booleans.

In this article:

Table of Contents Placeholder

How it Works

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.

Array of Strings Enrichments

The array of strings attribute stores a list of text values.

The array of strings is available in the following scopes: Event, Visit, Visitor.

Screenshot 2019-11-11 at 1.24.29 PM.png

Add a String

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"]

Add an Array of Strings

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"]

Difference Between Two Arrays

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 "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
["Pants", "Shirt", "Shoes", "Belt"]

and

Purchased Products
["Pants", "Shirt"]

RESULTING VALUE ["Shoes", "Belt"]

Reset

This enrichment removes all values from the array.

Attribute Name: product_name

STARTING VALUE ["Shoes", "Belt"]
ENRICHED WITH  
RESULTING VALUE []

Lowercase

This enrichment lowercases every value in the array.

Attribute Name: product_name

STARTING VALUE ["Shoes", "BELT"]
ENRICHED WITH  
RESULTING VALUE ["shoes", "belt"]

Set to Set of Strings

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"]

Add a Set of Strings

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"]

Remove a String from the Array

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"]

Array of Numbers Enrichments

The array of numbers attribute stores a list of numeric values.

The array of numbers is available in the following scopes: Event, Visit, Visitor.

Screenshot 2019-11-11 at 1.24.29 PM.png

String representations of numbers ("0", "123", "12.95") are converted to their numeric values. All other non-numeric values are ignored.

Add a Number

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 total_purchase value array.

Attribute Name: last_purchase

Starting Value [12.95]
Enriched With 5.99
Resulting Value [12.95, 5.99]

Add an Array of Numbers

This enrichment adds all the values from another array to the array. The added attribute can only be an array of numbers or iQ variable. For example, you may wish to add the array of last purchased purchase values to the array of all purchases.

Attribute Name: last_purchase

Starting Value [12.95]
Enriched With [5.99, 10.00]
Resulting Value [12.95, 5.99, 10.00]

Reset

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: last_purchase

Starting Value [12.00, 5.00]
Resulting Value []

Set Array of Numbers to be the Difference of Two Arrays

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:

Gift Card Amounts
[5.00, 10.00, 25.00, 50.00, 100.00, 250.00]

and

Gift Cards Purchased
[25.00, 50.00]

Resulting Value [5.00, 10.00, 100.00, 250.00]

Array of Booleans Enrichments

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.

Screenshot 2019-11-11 at 1.24.29 PM.png

The strings "true" and "false" (any mix of upper/lowercase) are converted to their respective boolean values. All other non-boolean values are ignored.

Add a Boolean

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: last_purchase

Starting Value [true]
Enriched With false
Resulting Value [true, false]

Add an Array of Booleans

This enrichment adds all the values from another array to the array. The added attribute can only be an array of booleans or iQ variables. For example, you may wish to add to the boolean array those visits in which the customer purchased items.

Attribute Name: last_purchase

Starting Value [true]
Enriched With [false, True]
Resulting Value [true, false, true]

Reset

This enrichment removes all values from the boolean array.

Attribute Name: last_purchase

Starting Value [true, false, true]
Enriched With  
Resulting Value []