목록 함수 list-functions

목록 함수를 사용하면 여정 표현식 내에서 값 컬렉션을 조작하고 작업할 수 있습니다. 이러한 기능은 고객 여정의 배열과 목록을 필터링, 정렬, 변환 및 분석하는 데 필수적입니다.

다음과 같은 작업을 수행할 때 목록 함수를 사용합니다.

  • 기준(filter, getListItem)을 기반으로 컬렉션에서 특정 항목 필터링 및 추출
  • 목록 요소를 오름차순 또는 내림차순으로 정렬 및 구성(정렬)
  • 중복 항목을 제거하고 목록에서 고유 값을 가져옵니다(distinct, distinctWithNull).
  • 값이 컬렉션(in) 내에 있는지 확인
  • 목록에서 반환되는 항목 수 제한(limit)
  • 목록 크기(listSize)를 가져오거나 목록을 다른 형식으로 변환(serializeList)
  • 목록(intersect) 간에 공통 요소를 찾는 것과 같은 집합 작업을 수행합니다.

목록 함수는 복잡한 데이터 구조 작업을 위한 강력한 도구를 제공하며 복잡한 데이터 조작과 수집 콘텐츠를 기반으로 하는 조건부 논리를 가능하게 합니다.

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
"productListItems": [{
   "id": "product1",
   "name": "the product 1",
   "price": 20
},{
   "id": "product2",
   "name": "the product 2",
   "price": 30
},{
   "id": "product3",
   "name": "the product 3",
   "price": 50
}]

다음 표현식을 사용할 수 있습니다.

code language-json
filter(
 @event{myevent.productListItems},
 "id",
 ["product2", "product3", "product4"]
)

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
intersect(
    ["sports", "news", "documentary"],
    ["sports", "movies", "documentary"]
)

[“sports”, “news”] 반환

code language-json
intersect(
    #{ExperienceDataPlatform.profile.interests},
    ["sports", "documentary"]
)

프로필 속성과 지정된 범주 목록 간의 공통 항목을 반환합니다.

code language-json
intersect(
    #{ExperienceDataPlatform.profile.interests},
        @event{myEvent.sport_interests}
)

프로필 속성과 지정된 이벤트 필드 간의 공통 항목을 반환합니다.

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 형식)에 있는 개체 수를 반환합니다.

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 반환(오름차순)

AI 기술 자료 참조

이 단원에는 이 주제와 관련된 해석, 검색 및 질문 답변을 지원하기 위한 구조화된 지식이 포함되어 있습니다.

이해를 돕기 위해 이 정보를 이 페이지의 설명서와 통합해야 합니다. 두 소스 모두 독립적으로 사용하기 위한 것은 아닙니다. 이 페이지에서는 기능에 대해 설명하지만, 용어, 의도, 적용 가능성 및 제약 조건을 명확히 하는 데 도움이 되는 추가 컨텍스트를 제공합니다.

  • TL;DR: 이 페이지에서는 목록 및 배열의 교차를 필터링, 정렬, 중복 제거, 멤버십 확인, 제한, 직렬화 및 찾는 방법에 대해 다루는 AJO 여정 표현식에서 사용할 수 있는 모든 목록 함수를 문서화합니다.

의도:

  • distinct(null 무시) 또는 distinctWithNull(null 보존)을 사용하여 목록에서 중복 값을 제거합니다.
  • filter을(를) 사용하여 특정 키 값과 일치하는 개체만 반환하도록 listObject 필터링
  • getListItem을(를) 사용하여 목록에서 특정 인덱스의 요소를 검색합니다.
  • in을(를) 사용하여 목록에 값이 있는지 확인
  • intersect을(를) 사용하여 두 목록 사이에서 공통 요소 찾기
  • limit을(를) 사용하여 목록의 첫 번째 또는 마지막 N개 요소 반환
  • listSize을(를) 사용하여 목록의 총 요소 수를 계산합니다.
  • serializeList을(를) 사용하여 목록을 구분된 문자열로 변환
  • sort을(를) 사용하여 목록을 오름차순 또는 내림차순으로 정렬

용어집:

  • listObject: 필드 참조여야 하는 복잡한 개체 목록입니다. null 개체 (제품별)은 포함할 수 없습니다.
  • keyAttributeName: (제품별)의 중복 제거, 필터링 또는 정렬에 사용할 개체 특성을 식별하기 위해 distinct, filtersort과(와) 함께 사용되는 선택적 문자열 매개 변수
  • intersect: 두 입력 목록에 있는 요소만 반환하는 집합 작업입니다.

보호 기능:

  • distinctWithNull은(는) <listObject> 매개 변수 형식을 지원하지 않습니다.
  • filter을(를) 사용하려면 listObject 매개 변수가 인라인 리터럴이 아닌 필드 참조여야 합니다.
  • listObject의 listSize에는 목록이 필드 참조여야 합니다. listObject에는 null 개체가 포함될 수 없습니다.
  • serializeList은(는) listObject 형식을 지원하지 않습니다.

용어:

  • 정식 이름: 목록 함수 — 약어: 없음 — 변형: 컬렉션 함수, 배열 함수
  • 동의어: “listSize” = “count list elements”; “serializeList” = “list to string”
  • 혼동하지 마십시오. “distinct”(null 무시) ≠ “distinctWithNull”(null을 고유한 값으로 유지)
  • 혼동하지 마십시오. "limit"을 세 번째 매개 변수 true(첫 번째 N개 항목 반환)과 ≠ "limit"을 false(마지막 N개 항목 반환)과 함께 사용합니다.
  • 혼동하지 마십시오. “교차”(두 목록 간의 공통 요소) ≠ “필터링”(특정 키 값과 일치하는 요소)

FAQ:

  • Q: 목록의 처음 3개 항목을 어떻게 얻습니까?limit(myList, 3) 또는 limit(myList, 3, true)을(를) 사용합니다. 기본적으로 첫 번째 항목이 반환됩니다.
  • Q: 목록의 마지막 3개 항목을 어떻게 얻습니까?limit(myList, 3, false) 사용.
  • Q: distinct과(와) distinctWithNull의 차이점은 무엇입니까?distinct은(는) null 값을 무시하고 결과에서 제외합니다. distinctWithNull은(는) null을 개별 값으로 취급하고 null이 있으면 하나의 null 항목을 포함합니다.
  • Q: filter을(를) 사용하여 문자열 목록을 필터링할 수 있습니까? — 아니요, filter은(는) listObject에서만 작동합니다. 스칼라 목록의 경우 중복 제거에는 in 또는 distinct을(를) 사용합니다.
  • Q: 값이 목록에 있는지 어떻게 확인합니까? — 목록에 값이 있으면 true를 반환하는 in(value, myList)을(를) 사용합니다.
  • Q: listObject를 특정 특성별로 정렬할 수 있습니까? — 예. 두 번째 매개 변수는 특성 이름이고 세 번째 매개 변수는 정렬 방향입니다(true = 오름차순).sort(@event{...}, "attributeName", true)
recommendation-more-help
journey-optimizer-help