I have an enrichment activity that divides the feature column into 4 parts. Now, I need to calculate how many features purchased, knowing that a customer can purchase one or more features. I am implementing this using a JavaScript function. Please advise on how to accomplish this.
vars.recCount currently retrieves the total number of records.
Thank you in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Hello! Maybe try doing an enrichment, adding a new field and putting something together in the expression editor like:
Case(When(<field1> = NULL, 0),Else(1) ) + Case(When(<field2> = NULL, 0),Else(1) ) + Case(When(<field3> = NULL, 0),Else(1) ) + Case(When(<field4> = NULL, 0),Else(1) )
Each of the : Case(When(<field1> = NULL, 0),Else(1) ) parts just checks to see if your specific field is empty or not, then returns 0/1 depending on if it is. After that, it'll sum the numbers together and you get your count of how many of the product fields are filled/not. Just make sure you update each of the <field1/2/3> parts to be your specific fields.
Views
Replies
Total Likes
Hello! Maybe try doing an enrichment, adding a new field and putting something together in the expression editor like:
Case(When(<field1> = NULL, 0),Else(1) ) + Case(When(<field2> = NULL, 0),Else(1) ) + Case(When(<field3> = NULL, 0),Else(1) ) + Case(When(<field4> = NULL, 0),Else(1) )
Each of the : Case(When(<field1> = NULL, 0),Else(1) ) parts just checks to see if your specific field is empty or not, then returns 0/1 depending on if it is. After that, it'll sum the numbers together and you get your count of how many of the product fields are filled/not. Just make sure you update each of the <field1/2/3> parts to be your specific fields.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies