cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

How to count values occurrences in value stream?

PB_9026895
5-Regular Member

How to count values occurrences in value stream?

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

3 REPLIES 3
slangley
23-Emerald II
(To:PB_9026895)

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

slangley
23-Emerald II
(To:slangley)

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

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.

Top Tags