Hi,
I'm not a developer and I'm trying to write an expression to count the number of a string field nested within string arrays (screenshot). This expression is intended for use in one of the Custom Actions variable fields in Journey. Below is the expression I attempted, along with the error I received: "The expression is invalid : Unexpected usage of the character '('. It seems that you should better use the '}' here."
Expression in question:
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3 [].ObjectLevel4 [].each(currentDataPackField.plan)}
Kindly take note that there can be more than 1 ObjectLevel4 hence more than 1 plan.
Thanks!
해결되었습니다! 솔루션으로 이동.
토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.
조회 수
답글
좋아요 수
Hi @Mohan_Dugganab, very close:
Error: The expression is invalid : Unexpected character ')'. It seems that you are missing something before this
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3.all(currentDataPackField.PathTofieldWithinObjectLevel3 !=).pathToObjectLevel4.all(currentDataPackField.PathTofieldWithinObjectLevel4.all())})
If I replace " != " with ".all()" in red, error is "The expression is invalid : Data pack field not found. It may have been deleted or you don't have permission to use it."
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3.all(currentDataPackField.PathTofieldWithinObjectLevel3.all()).pathToObjectLevel4.all(currentDataPackField.PathTofieldWithinObjectLevel4.all())})
Hello @AK5 ,
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3 [].ObjectLevel4 [].each(currentDataPackField.plan)}).
at the end of expression, i can see that you missed closing bracket ")".
Can you try this expression:
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3[].ObjectLevel4[].currentDataPackField.plan})
Thanks
AJODev
조회 수
답글
좋아요 수
Hi @AJODev,
Thanks for looking into this! I'm getting a new error msg: "The expression is invalid : You cannot use the word 'currentDataPackField' like this because it is a keyword of the language. Please, add quotes to fix your expression."
Any idea?
Thanks!
조회 수
답글
좋아요 수
@AK5
Thanks for sharing with error message .try this expression
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3[].ObjectLevel4[]['currentDataPackField'].plan})
Thanks
AJODev
조회 수
답글
좋아요 수
Hi @AJODev,
Almost there I reckon, it now says: "The expression is invalid : You cannot use the character '[' like this because it is a keyword of the language. Please, add quotes to fix your expression."
Thanks!
조회 수
답글
좋아요 수
can you try adding double quotes to keyword "currentDataPackField" in your expression.
조회 수
답글
좋아요 수
Unexpected usage of the word '"currentDataPackField"'. It seems that you should better use the '}' here.
Other attempts:
1) {'currentDataPackField'}.plan}) > Unexpected usage of the character '{'. It seems that you should better use the '}' here.
2) ("currentDataPackField").plan}) > Unexpected usage of the character '('. It seems that you should better use the '}' here.
Thanks!
조회 수
답글
좋아요 수
You can validate it on the following lines
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3.all(currentDataPackField.PathTofieldWithinObjectLevel3 == '<filter value>').
pathToObjectLevel4.all(currentDataPackField.PathTofieldWithinObjectLevel4 == '<filter value>')}
조회 수
답글
좋아요 수
Hi @Mohan_Dugganab, given i'm looking to count the number of plan(s) that's a string, and the string field is hidden in an array that's also in an array of a few more arrays (as per screenshot), what do you suggest I replace == '<filter value>' with?
Thanks!
조회 수
답글
좋아요 수
You can either put a condition like .....pathToPlanId != '' or remove the filter if you want to count all of them in ObjectLevel4 array object by specifying ...pathToObjectLevel4.all()}
조회 수
답글
좋아요 수
Hi @Mohan_Dugganab, very close:
Error: The expression is invalid : Unexpected character ')'. It seems that you are missing something before this
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3.all(currentDataPackField.PathTofieldWithinObjectLevel3 !=).pathToObjectLevel4.all(currentDataPackField.PathTofieldWithinObjectLevel4.all())})
If I replace " != " with ".all()" in red, error is "The expression is invalid : Data pack field not found. It may have been deleted or you don't have permission to use it."
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3.all(currentDataPackField.PathTofieldWithinObjectLevel3.all()).pathToObjectLevel4.all(currentDataPackField.PathTofieldWithinObjectLevel4.all())})
Thanks @Mohan_Dugganab. I believe that should be right as I am not getting validation error rather, I'm getting the permission issue.
조회 수
답글
좋아요 수