Skip to main content
1-Visitor
January 21, 2021
Question

How to count values occurrences in value stream?

  • January 21, 2021
  • 2 replies
  • 1323 views

Hi all,

I want to count values occurrences in value stream and store it in an infotable with two entries (value,count)

Example :

data in value stream = 1,1,2,2,3,3,

infotable count = (1,2) (2,2) (3,2)

How can I do it?

Thanks

2 replies

Support
January 22, 2021

Hi @PB_9026895.

 

One possibility is to use the distinct function in the Infotables function resource to allow you to retrieve the ocurrences and write to a new infotable.  Then run another service such as EQFilter to loop through the new infotable to count the occurrences.  This could potentially be an intensive task depending on the size of the value stream.  Recommend testing in Dev before migrating to Prod.

 

Regards.

 

--Sharon

Support
February 1, 2021

Hi @PB_9026895.

 

If one of the previous responses helped you to find a solution, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

5-Regular Member
January 25, 2021

It actually looks like a job interview question to me.

If we don't know the range of the value in the VS, we cannot use a filter to scan the infotable for unpredictable times, we need to take the  VS data as incoming data stream, writing to an infotable with shape [Value; count]. If it's a new value, add a row to the infotable and set count to 1, if it's an exisiting value, add number to the count.