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!
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
@AK5
Thanks for sharing with error message .try this expression
listSize(#{ExperiencePlatform.ProfileFieldGroup.profile._ObjectLevel1.ObjectLevel2.ObjectLevel3[].ObjectLevel4[]['currentDataPackField'].plan})
Thanks
AJODev
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
can you try adding double quotes to keyword "currentDataPackField" in your expression.
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
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>')}
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
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()}
Views
Replies
Total Likes
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.
Views
Replies
Total Likes