How to count items with specific values in a data store?

Hi there,

I try to count items with specific values in a data store.

My data store looks like this:

I would like to count how many times an item of “Klasse_ID” is stored in the data store. In relation to the screenshot it should return a value of “2” for the item “505” of “Klasse_ID”.

I tried a lot of variations of data store triggers (search, count) and aggregators. Nothing returned the value I’m searching for.

Can anyone help?

@tobimahony

Unfortunately, There is no option to count the specific values from datastore.

MSquare Support
Visit us here
Youtube Channel

1 Like

Thank you for your quick reply and your help! I’m really surprised I can’t do that in Make.

Hello there @tobimahony :wave:

You should be able to achieve this by listing all the records in your data store, turning them into an array, and using a combo of functions (general, math, array) to modify the output the way it returns (counts) only the requested values.

These resources could help when learning more about functions:

Hey Michaela, thanks for your comprehensive reply! I’ll work my way through it and give it a try. :+1:

Hi @tobimahony

I’m sorry for any confusion. What I meant is that the data store doesn’t have any option directly, but you can achieve it by utilizing the array aggregator within the Make.

Hi @tobimahony

You can aggregate all records into the array.

Iterate and deduplicate the array of IDs (Klasse_ID). This way, only unique IDs will be output.

Set multiple variables - ID (Klasse_ID) from the iterator and the number of occurrences (count) in the original array from the first aggregator (=in the data store) using the set of functions with the use of the iterated IDs and date (Angesehen am) below.

Finally, you can aggregate them to get a new array of IDs and their count you can use anywhere further in the scenario flow.

I hope it makes sense :wink:

1 Like

Thank you very much for your extensive reply! As soon as I can get back to it I will give it a try. :+1:

1 Like

This is an excellent explanation! Thank you very much again @Jobless_Tobacconist. Sorry for the wait for my answer, I couldn’t get back to work the last days.

1 Like