Highlighted
Regular Contributor

Count items in a list

Hi,

I want to do something that seems simple, i have a list (Complaint list), and it has a field (text) called custRef which is not unique.

I am in another module and when a user enters a CustRef (text field) i want to then count how many times that appears in the Complaint list.

 

As the CustRef is not from a list, and just a text field I am a little stuck?

 

thanks

 

 

3 REPLIES 3
Highlighted
Master Anaplanner/Community Boss

Re: Count items in a list

Hi Developer CYT,

 

Perhaps you can refer to 

https://community.anaplan.com/t5/Calculation-Functions/How-to-take-the-count-of-a-text-value-that-re...

 

and see if it does the job. You'll need to modify a bit to make it work for you, but the general idea should be similar.

 

Thanks,

LipChean

Highlighted
Occasional Contributor

Re: Count items in a list

Hi @DeveloperCYT,

as suggested in the post shared by @LipChean_Soh , you see that you could consider making CustRef a list formatted line item rather than free text, especially if you are starting to report on it.

 

In a text field, you could easily have typos or different ways to reference the same customer (i.e. adding Inc or Ltd at the end or not...).

 

Obviously, I don't know exactly your requirements so you may have a reason to keep it as text. If that's the case, you can share it and we can see how to approach it.

 

Thanks,

Michele

Highlighted
Certified Master Anaplanner

Re: Count items in a list

Hi DeveloperCYT,

Hope I understand you issue correctly - you have a text formatted property in a Complaint list called CustRef, and you want to see how often the value entered by user is found in this property.

To do so please create a Comp Module that has Complaint list as dimension, it will have two line items:

  1. CustRef - text formatted - picks up value from CustRef property of the list
  2. Count CustRef - number formatted - formula: IF CustRef = Input Module.CustRef THEN 1 ELSE 0

You will also have an Input Module with two line items:

  1. CustRef - text formatted - used for user input
  2. Count Occurrences - number formatted - formula: Comp Module.Count CustRef

Your Complaint list must have a top level for this to work

Best regards,

Egor.