Filter tag dataset?

Hi All, I have a tag that gets updated with audit logs
it has 3 columns
entryTime, message, level

I’m trying to find the count of a specific message for example
Table looks like this:
entryTime message level
Apr 29, 2022 2:10 PM dumpComplete Calculation Started 0
Apr 29, 2022 2:09 PM MACHINE: SYSTEM PROCESSING PLEASE WAIT 0
Apr 29, 2022 2:09 PM MACHINE: PRODUCT INFO NOT READY 0
Apr 29, 2022 1:54 PM MACHINE: SAFETY GATE OPEN 0
Apr 29, 2022 1:21 PM Pulled Safety Gate to Early 0

Its a big dataset over 100k rows and I’m trying to just get the count of the rows with the message
“Pulled Safety Gate to Early”

I’ve got the data in a table and I was trying to loop through to find the specific value, but couldn’t get anything to work.

How would I go about doing this?
Any help would be appreciated

Thanks.

Something like this should do the trick:

	count = 0
	data = self.getSibling("Table").props.data
	for row in range(data.getRowCount()):
		message = data.getValueAt(row, 'message')
		if message == "Pulled Safety Gate to Early":
			count += 1
1 Like

Filter tag dataset
I have a tag ...

Then

Table looks like this:...

Which is it? A tag or a table?

Is this Perspective or Vision? Add the appropriate tag to your question.

Can you post the first few rows of data from the table in JSON format? When posting code please use the </> code formatting button to preserve spacing, indentation and syntax highlightng.

Thank you for the help this worked :slight_smile:

If you’re going to do it for several messages and not just one, consider using collections.Counter ()instead.

from collections import Counter

data = self.getSibling("Table").props.data
count = Counter([data.getValueAt(row, 'Source') for row in range(data.getRowCount())])

Counter has several interesting method, it can for example tell you the most frequently occurring item with count.most_common()