목록 함수 list-functions
목록 함수를 사용하면 여정 표현식 내에서 값 컬렉션을 조작하고 작업할 수 있습니다. 이러한 기능은 고객 여정의 배열과 목록을 필터링, 정렬, 변환 및 분석하는 데 필수적입니다.
다음과 같은 작업을 수행할 때 목록 함수를 사용합니다.
- 기준(filter, getListItem)을 기반으로 컬렉션에서 특정 항목 필터링 및 추출
- 목록 요소를 오름차순 또는 내림차순으로 정렬 및 구성(정렬)
- 중복 항목을 제거하고 목록에서 고유 값을 가져옵니다(distinct, distinctWithNull).
- 값이 컬렉션(in) 내에 있는지 확인
- 목록에서 반환되는 항목 수 제한(limit)
- 목록 크기(listSize)를 가져오거나 목록을 다른 형식으로 변환(serializeList)
- 목록(intersect) 간에 공통 요소를 찾거나 목록(mergeLists)을 결합하거나 다른 목록(differenceLists)에서 한 목록을 빼는 것과 같은 집합 작업을 수행합니다.
목록 함수는 복잡한 데이터 구조 작업을 위한 강력한 도구를 제공하며 복잡한 데이터 조작과 수집 콘텐츠를 기반으로 하는 조건부 논리를 가능하게 합니다.
차이점 목록 differenceLists
두 번째 목록에 없는 첫 번째 목록의 항목을 반환합니다(설정 차이점: list 1 - list 2). Null 항목을 건너뜁니다. 결과는 항상 중복 값을 제거하고 첫 번째 목록의 삽입 순서를 유지합니다.
differenceLists(<parameters>)| table 0-row-3 1-row-3 2-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| 목록 1 | listString, listInteger, listDecimal, listBoolean, listDuration, listDateTime, listDateTimeOnly 또는 listDateOnly | 뺄 목록입니다. |
| 목록 2 | 목록 1과 동일한 유형입니다. | 목록 1에서 제거할 항목의 목록입니다. |
differenceLists(listString,listString): listString
differenceLists(listInteger,listInteger): list정수
differenceLists(listDecimal,listDecimal): listDecimal
differenceLists(listBoolean,listBoolean): list부울
differenceLists(listDuration,listDuration): listDuration
differenceLists(listDateTime,listDateTime): listDateTime
differenceLists(listDateTimeOnly,listDateTimeOnly): listDateTimeOnly
differenceLists(listDateOnly,listDateOnly): listDateOnly
| code language-json |
|---|
|
['a','c']을(를) 반환합니다
| code language-json |
|---|
|
['a','b']을(를) 반환합니다
| code language-json |
|---|
|
[]을(를) 반환합니다
distinct distinct
주어진 목록의 고유 값 또는 개체를 반환합니다. Null 항목은 무시됩니다.
distinct(<parameters>)| table 0-row-3 1-row-3 2-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToprocess | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly 또는 listObject | 처리할 목록. listObject의 경우 필드 참조여야 합니다. |
| keyAttributeName | 문자열 | 이 매개 변수는 선택 사항이며 listObject에만 사용됩니다. 매개변수를 제공하지 않으면 모든 속성의 값이 동일한 경우 객체가 복제된 것으로 간주됩니다. 그렇지 않으면, 지정된 속성에 동일한 값이 있으면 객체가 복제된 것으로 간주됩니다. |
distinct(<listInteger>)
정수 목록을 반환합니다.
distinct(<listDecimal>)
소수점 목록을 반환합니다.
distinct(<listString>)
문자열 목록을 반환합니다.
distinct(<listDateTimeOnly>)
시간대를 고려하지 않고 날짜/시간 목록을 반환합니다.
distinct(<listDateTime>)
날짜/시간 목록을 반환합니다.
distinct(<listDateOnly>)
날짜 목록을 반환합니다.
distinct(<listBoolean>)
부울 목록을 반환합니다.
distinct(<listDuration>)
기간 목록을 반환합니다.
distinct(<listObject>)
distinct(<listObject>,<string>)
개체 목록을 반환합니다.
distinct([10,2,10,null])
[10, 2]을(를) 반환합니다
distinctWithNull distinctWithNull
주어진 목록의 고유 값 또는 개체를 반환합니다. 목록에 null 항목이 하나 이상 있으면 반환된 목록에 null 항목이 표시됩니다.
distinctWithNull(<parameters>)| table 0-row-3 1-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToprocess | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly | 처리할 목록. |
distinctWithNull(<listInteger>)
정수 목록을 반환합니다.
distinctWithNull(<listDecimal>)
소수점 목록을 반환합니다.
distinctWithNull(<listString>)
문자열 목록을 반환합니다.
distinctWithNull(<listDateTimeOnly>)
시간대를 고려하지 않고 날짜/시간 목록을 반환합니다.
distinctWithNull(<listDateTime>)
날짜/시간 목록을 반환합니다.
distinctWithNull(<listDateOnly>)
날짜 목록을 반환합니다.
distinctWithNull(<listBoolean>)
부울 목록을 반환합니다.
distinctWithNull(<listDuration>)
기간 목록을 반환합니다.
distinctWithNull([10,2,10,null])
[10, 2, null] 반환
참고: 매개 변수 <listObject>은(는) 이 함수에서 지원되지 않습니다.
filter filter
지정된 키 값 중 하나와 일치하는 키 특성을 가진 개체와 함께 listObject를 반환합니다.
filter(<parameters>)| table 0-row-3 1-row-3 2-row-3 3-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listTofilter | listObject | 필터링할 객체 목록입니다. 필드 참조여야 합니다. |
| keyAttributeName | 문자열 | 해당 목록의 개체에서 필터링용 키로 사용되는 속성 이름 |
| 키 값 목록 | list | 필터링에 사용할 키 값 배열 |
filter(listObject, string, listString)
filter(listObject, string, listInteger)
filter(listObject, string, listDecimal)
filter(listObject, string, listDateTime)
filter(listObject, string, listDateTimeOnly)
filter(listObject, string, listDateOnly)
filter(listObject, string, listDuration)
filter(listObject, string, listBoolean)
listObject를 반환합니다.
다음은 수신 이벤트 "myevent"에서 전달된 페이로드의 예입니다.
| code language-json |
|---|
|
다음 표현식을 사용할 수 있습니다.
| code language-json |
|---|
|
id로 “product2” 및 "product3"을 사용하는 두 개체가 포함된 listObject를 반환합니다.
getListItem getListItem
지정된 인덱스에서 목록의 항목을 반환합니다.
getListItem(<parameters>)| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 | |
|---|---|
| 매개 변수 | 유형 |
| list | listString |
| list | list부울 |
| list | list정수 |
| list | listDecimal |
| list | listDuration |
| list | listDateTime |
| list | listDateTimeOnly |
| list | listDateOnly |
| 색인 | 정수 |
getListItem(<listInteger>,<index>)
정수 반환.
getListItem(<listDecimal>,<index>)
십진수를 반환합니다.
getListItem(<listString>,<index>)
문자열을 반환합니다.
getListItem(<listDateTimeOnly>,<index>)
시간대를 고려하지 않고 날짜/시간을 반환합니다.
getListItem(<listDateTime>,<index>)
날짜/시간을 반환합니다.
getListItem(<listDateOnly>,<index>)
날짜 목록을 반환합니다.
getListItem(<listBoolean>,<index>)
부울 반환.
getListItem(<listDuration>,<index>)
기간을 반환합니다.
getListItem([10, 2, 3], 1)
“2” 반환
getListItem(["A", "B", "C"], 2)
“C” 반환
값이 "20.45.2.3434"인 이벤트 필드 'event.appVersion’이 있는 예
split(@event{event.appVersion}, "\\.")
["20", "45", "2", "3434"] 반환
getListItem(split(@event{event.appVersion}, "\\."), 0)
“20” 반환
in in
첫 번째 인수 값이 목록에 있는지 확인합니다. 각 인수 값에 대해 같음 을 통해 확인이 수행됩니다. 인수 값이 발견되면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
<expression>의 형식은 목록의 항목과 일치해야 합니다. 미리 알림으로 목록의 항목 유형은 서로 일치해야 합니다.
in(<parameters>)| table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 10-row-2 11-row-2 12-row-2 13-row-2 14-row-2 15-row-2 | |
|---|---|
| 매개 변수 | 유형 |
| 문자열 | 문자열 |
| 부울 | 부울 |
| 정수 | 정수 |
| 소수 | 소수 |
| 지속 시간 | 지속 시간 |
| 날짜/시간 | 날짜/시간 |
| 날짜/시간만 | 날짜/시간만 |
| 목록 | listString |
| 목록 | list부울 |
| 목록 | list정수 |
| 목록 | listDecimal |
| 목록 | listDuration |
| 목록 | listDateTime |
| 목록 | listDateTimeOnly |
| 목록 | listDateOnly |
in(<integer>,<listInteger>)
in(<decimal>,<listDecimal>)
in(<string>,<listString>)
in(<boolean>,<listBoolean>)
in(<dateTimeOnly>,<listDateTimeOnly>)
in(<dateTime>,<listDateTime>)
in(<dateOnly>,<listDateOnly>)
in(<duration>,<listDuration>)
부울 반환.
in(4,[4,5,3,4])
true를 반환합니다.
in(8,[4,5,3,4])
false를 반환합니다.
in(#{ExperiencePlatform.ProfileFieldGroup.profile.person.gender}, ["male"])
intersect intersect
두 입력 목록의 공통 값을 반환합니다. 두 목록 중 하나가 null이면 빈 목록을 반환합니다.
intersect(<parameters>)| table 0-row-2 1-row-2 2-row-2 | |
|---|---|
| 매개 변수 | 유형 |
| 목록 1 | list |
| 목록 2 | list |
intersect(listString,listString): listString
intersect(listDecimal,listDecimal): listDecimal
intersect(listInteger,listInteger): list정수
intersect(listDateTime,listDateTime): listDateTime
intersect(listDateTimeOnly,listDateTimeOnly): listDateTimeOnly
intersect(listDateOnly,listDateOnly): listDateOnly
intersect(listDuration,listDuration): listDuration
intersect(listBoolean,listBoolean): list부울
목록을 반환합니다.
| code language-json |
|---|
|
[“sports”, “news”] 반환
| code language-json |
|---|
|
프로필 속성과 지정된 범주 목록 간의 공통 항목을 반환합니다.
| code language-json |
|---|
|
프로필 속성과 지정된 이벤트 필드 간의 공통 항목을 반환합니다.
limit limit
목록의 첫 번째 또는 마지막 N 요소를 반환합니다.
limit(<parameters>)| table 0-row-3 1-row-3 2-row-3 3-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToprocess | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly 또는 listObject | 고려할 목록입니다. listObject의 경우 필드 참조여야 합니다. |
| numberOfItems | 정수 | 해당 목록에서 반환할 항목 수. |
| 첫 번째 또는 마지막 항목 | 부울 | 이 매개 변수는 선택 사항입니다(기본값: true). true는 첫 번째 항목을 반환합니다. false는 마지막 항목을 반환합니다. |
limit(<listString>,<integer>)
limit(<listString>,<integer>,<boolean>)
문자열 목록을 반환합니다.
limit(<listInteger>,<integer>)
limit(<listInteger>,<integer>,<boolean>)
정수 목록을 반환합니다.
limit(<listDecimal>,<integer>)
limit(<listDecimal>,<integer>,<boolean>)
소수점 목록을 반환합니다.
limit(<listBoolean>,<integer>)
limit(<listBoolean>,<integer>,<boolean>)
부울 목록을 반환합니다.
limit(<listDateOnly>,<integer>)
limit(<listDateOnly>,<integer>,<boolean>)
날짜 목록을 반환합니다.
limit(<listDateTimeOnly>,<integer>)
limit(<listDateTimeOnly>,<integer>,<boolean>)
시간대를 고려하지 않고 날짜/시간 목록을 반환합니다.
limit(<listDateTime>,integer>)
limit(<listDateTime>,<integer>,<boolean>)
날짜/시간 목록을 반환합니다.
limit(<listDuration>,<integer>)
limit(<listDuration>,<integer>,<boolean>)
기간 목록을 반환합니다.
limit(<listObject>,<integer>)
limit(<listObject>,<integer>,<boolean>)
개체 목록을 반환합니다.
limit(["A", "B", "C", "D", "E"], 3)
["A","B","C"]을(를) 반환합니다
limit(["A", "B", "C", "D", "E"], 3, false)
["C","D","E"]을(를) 반환합니다
listSize listSize
목록의 요소 수를 계산합니다.
listSize(<parameters>)| table 0-row-3 1-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToprocess | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly 또는 listObject | 처리할 목록. listObject의 경우 필드 참조여야 합니다. listObject는 null 개체를 포함할 수 없습니다. |
listSize(<listInteger>)
listSize(<listDecimal>)
listSize(<listString>)
listSize(<listBoolean>)
listSize(<listDateTimeOnly>)
listSize(<listDateTime>)
listSize(<listDateOnly>)
listSize(<listDuration>)
정수를 반환합니다.
listSize(<listObject>)
listSize([10,2,3])
3을 반환합니다.
listSize(@event{my_event.productListItems})
지정된 개체 배열(listObject 형식)에 있는 개체 수를 반환합니다.
병합 목록 mergeLists
두 목록을 결합합니다. deduplicate이(가) true인 경우 중복 값이 제거된 두 목록의 합집합을 반환합니다. deduplicate이(가) false이면 두 목록(목록 1의 항목 뒤에 목록 2의 항목)의 연결을 반환하여 중복을 유지합니다. Null 항목을 건너뜁니다.
참고: deduplicate 매개 변수는 동적 부울 식이 아닌 리터럴 true 또는 false이어야 합니다.
mergeLists(<parameters>)| table 0-row-3 1-row-3 2-row-3 3-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| 목록 1 | listString, listInteger, listDecimal, listBoolean, listDuration, listDateTime, listDateTimeOnly 또는 listDateOnly | 첫 번째 목록입니다. 해당 항목이 결과에 먼저 추가됩니다. |
| 목록 2 | 목록 1과 동일한 유형입니다. | 두 번째 목록입니다. 이 항목의 항목은 목록 1의 항목 뒤에 추가됩니다. |
| 중복 제거 | 부울 리터럴 | true은(는) 중복 항목이 제거된 두 목록의 유니온을 반환합니다. false은(는) 중복을 유지하면서 두 목록의 연결을 반환합니다. 리터럴 true 또는 false이어야 합니다. |
mergeLists(listString,listString,boolean): listString
mergeLists(listInteger,listInteger,boolean): list정수
mergeLists(listDecimal,listDecimal,boolean): listDecimal
mergeLists(listBoolean,listBoolean,boolean): list부울
mergeLists(listDuration,listDuration,boolean): listDuration
mergeLists(listDateTime,listDateTime,boolean): listDateTime
mergeLists(listDateTimeOnly,listDateTimeOnly,boolean): listDateTimeOnly
mergeLists(listDateOnly,listDateOnly,boolean): listDateOnly
| code language-json |
|---|
|
['a','b','c']을(를) 반환합니다
| code language-json |
|---|
|
['a','b','b','c']을(를) 반환합니다
serializeList serializeList
지정된 목록(listObject를 제외한 모든 유형)을 문자열로 변환합니다.
serializeList(<parameters>)| table 0-row-3 1-row-3 2-row-3 3-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToprocess | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly | 문자열로 변환할 목록입니다. |
| 분리자 | 문자열 | 출력 문자열에서 각 목록 요소 사이의 구분 기호입니다. |
| addQuotes | 부울 | 이 매개 변수는 출력 문자열의 각 요소에 따옴표(true)를 포함해야 하는지 여부를 나타냅니다(false). |
serializeList(<listInteger>,<string>,<boolean>)
serializeList(<listDecimal>,<string>,<boolean>)
serializeList(<listString>,<string>,<boolean>)
serializeList(<listBoolean>,<string>,<boolean>)
serializeList(<listDateTimeOnly>,<string>,<boolean>)
serializeList(<listDateTime>,<string>,<boolean>)
serializeList(<listDateOnly>,<string>,<boolean>)
serializeList(<listDuration>,<string>,<boolean>)
문자열을 반환합니다.
serializeList(["Hello","World"], " ", false)
"Hello World"를 반환합니다.
serializeList(["Hello", "World"], ",", true)
"“Hello”,“World”"를 반환합니다.
sort sort
값 또는 개체 목록을 원래 순서로 정렬합니다.
sort(<parameters>)| table 0-row-3 1-row-3 2-row-3 3-row-3 | ||
|---|---|---|
| 매개 변수 | 유형 | 설명 |
| listToSort | listString, listBoolean, listInteger, listDecimal, listDuration, listDateTime, listDateTimeOnly, listDateOnly 또는 listObject | 정렬할 목록입니다. listObject의 경우 필드 참조여야 합니다. |
| keyAttributeName | 문자열 | 이 매개 변수는 listObject에만 사용할 수 있습니다. 해당 목록의 개체에 있는 특성 이름은 정렬의 키로 사용됩니다. |
| 정렬 순서 | 부울 | 오름차순(true) 또는 내림차순(false) |
sort(<listInteger>,<boolean>)
정수 목록을 반환합니다.
sort(<listDecimal>,<boolean>)
소수점 목록을 반환합니다.
sort(<listString>,<boolean>)
문자열 목록을 반환합니다.
sort(<listDateTimeOnly>,<boolean>)
시간대를 고려하지 않고 날짜/시간 목록을 반환합니다.
sort(<listDateTime>,<boolean>)
날짜/시간 목록을 반환합니다.
sort(<listDateOnly>,<boolean>)
날짜 목록을 반환합니다.
sort(<listBoolean>,<boolean>)
부울 목록을 반환합니다.
sort(<listObject>,<string>,<boolean>)
개체 목록을 반환합니다.
sort(["A", "C", "B"], true)
["A","B","C"]을(를) 반환합니다
sort([1, 3, 2], false)
[3, 2, 1]을(를) 반환합니다
sort(@event{my_event.productListItems}, "SKU", true)
SKU 속성으로 정렬된 listObject 반환(오름차순)
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: This page documents all list functions available in AJO journey expressions, covering how to filter, sort, deduplicate, check membership, limit, serialize, merge, subtract, and find intersections of lists and arrays.
Intents:
- Remove duplicate values from a list using
distinct(ignoring nulls) ordistinctWithNull(preserving nulls) - Filter a listObject to return only objects matching specific key values using
filter - Retrieve an element at a specific index from a list using
getListItem - Check whether a value exists in a list using
in - Find common elements between two lists using
intersect - Combine two lists, with or without deduplication, using
mergeLists - Subtract one list from another (set difference) using
differenceLists - Return the first or last N elements of a list using
limit - Count the total number of elements in a list using
listSize - Convert a list to a delimited string using
serializeList - Sort a list in ascending or descending order using
sort
Glossary:
- listObject: A list of complex objects that must be a field reference; cannot contain null objects (product-specific)
- keyAttributeName: An optional string parameter used with
distinct,filter, andsortto identify which object attribute to use for deduplication, filtering, or sorting (product-specific) - intersect: A set operation returning only the elements present in both input lists
- mergeLists: A set operation returning the union (deduplicated) or concatenation (with duplicates) of two lists, depending on the
deduplicateparameter (product-specific) - differenceLists: A set operation returning the items of the first list that are not present in the second list (product-specific)
Guardrails:
distinctWithNulldoes not support the<listObject>parameter typefilterrequires the listObject parameter to be a field reference, not an inline literallistSizeon a listObject requires the list to be a field reference; a listObject cannot contain null objectsserializeListdoes not support thelistObjecttypemergeListsanddifferenceListsonly support scalar list types (string, integer, decimal, boolean, dateTime, dateTimeOnly, dateOnly, duration);listObjectis not supportedmergeLists’sdeduplicateparameter must be a literaltrue/false, not a dynamic boolean expressiondifferenceListsalways deduplicates its result; there is no option to keep duplicates
Terminology:
- Canonical name: List functions — Acronym: none — variants: collection functions, array functions
- Synonyms: “listSize” = “count list elements”; “serializeList” = “join list to string”
- Do not confuse: “distinct” (ignores nulls) ≠ “distinctWithNull” (preserves null as a distinct value)
- Do not confuse: “limit” with third parameter
true(returns first N items) ≠ “limit” withfalse(returns last N items) - Do not confuse: “intersect” (common elements between two lists) ≠ “filter” (elements matching specific key values)
- Do not confuse: “mergeLists” (combines two lists, union or concatenation) ≠ “differenceLists” (subtracts one list from another) ≠ “intersect” (common elements only)
FAQ:
- Q: How do I get the first 3 items of a list? — Use
limit(myList, 3)orlimit(myList, 3, true); the default is to return the first items. - Q: How do I get the last 3 items of a list? — Use
limit(myList, 3, false). - Q: What is the difference between
distinctanddistinctWithNull? —distinctignores null values and excludes them from the result;distinctWithNulltreats null as a distinct value and includes one null entry if any nulls are present. - Q: Can I filter a list of strings with
filter? — No,filteronly works onlistObject; for scalar lists useinordistinctfor deduplication. - Q: How do I check if a value is in a list? — Use
in(value, myList), which returns true if the value is found in the list. - Q: Can I sort a listObject by a specific attribute? — Yes, use
sort(@event{...}, "attributeName", true)where the second parameter is the attribute name and the third is the sort direction (true = ascending). - Q: How do I combine two lists and remove duplicates? — Use
mergeLists(list1, list2, true). - Q: How do I combine two lists but keep duplicate values? — Use
mergeLists(list1, list2, false). - Q: How do I find the items in one list that are not in another? — Use
differenceLists(list1, list2), which returns the items oflist1not present inlist2. - Q: What is the difference between
intersectanddifferenceLists? —intersectreturns items common to both lists;differenceListsreturns items in the first list that are absent from the second list.