Hi, I need to identify customers who turn 18 today from the birth date with an fx. How can I do it?
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
@PietroAm1 Unfortunately, there isn't a function available to determine the age; instead, you'll need to utilize an expression similar to what Mohan mentioned. Another option would be to use a computed attribute.
@PietroAm1 Use the computed attributes to calculate the age and use that field in the audience definition.
https://experienceleague.adobe.com/en/docs/experience-platform/profile/computed-attributes/overview
Pretty strange but we do not have this (and other functions) in AJO, that's why I've asked. I attach screenshot
조회 수
답글
좋아요 수
@PietroAm1 Unfortunately, there isn't a function available to determine the age; instead, you'll need to utilize an expression similar to what Mohan mentioned. Another option would be to use a computed attribute.
조회 수
답글
좋아요 수
@PietroAm1 Adobe Journey Optimizer provides Date functions, which you can use to manipulate and compare dates in your expressions, such as addYears, formatDate, and logical comparison operators.
here is what you can try:
if your birth date field is profile.person.birthDate, the expression in the audience rule or decision block would look like:
{{formatDate addYears profile.person.birthDate 18 "yyyy-MM-dd"}} == {{formatDate now "yyyy-MM-dd"}}
This logic checks if today's date (formatted as yyyy-MM-dd) matches the birth date plus 18 years (also formatted as yyyy-MM-dd). You may want to adapt the field name based on your profile schema.
조회 수
답글
좋아요 수
Thnaks, just tried with expression below, swapping my schema's field
{{formatDate addYears #{ExperiencePlatform.ProfileFieldGroup.profile._cagroupit.anagraficaCliente.DATA_NASCITA} 18 "YYYY-MM-DD"}} == {{formatDate now "yyyy-MM-dd"}}
it returns error
The expression is invalid : Unexpected character '{' . Please, check that it is a valid token and that you are using it at the right place.
조회 수
답글
좋아요 수
@PietroAm1 try
let dob= #{ExperiencePlatform.ProfileFieldGroup.profile._cagroupit.anagraficaCliente.DATA_NASCITA};
let eighteenth= date(getYear(dob)+18 , /* year */
getMonth(dob) , /* month */
getDayOfMonth(dob) /* day */);
/* Compare to today */
(eighteenth == toDateOnly(now()))
조회 수
답글
좋아요 수