Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

Get the total count of features purchased

Avatar

Level 5
Hi there, 
 

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

1 Reply

Avatar

Level 3

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.