AscentialTest Support Hub

Counting occurrence…

 

Notifications

Clear all

Counting occurrences of a value in a table



1

Posts


1

Users


0

Reactions


35.3 K

Views

(@gordonweil)
Active Member

Joined: 10 years ago
Posts: 2

Topic starter
 

The arguments are the name of the column in the row and the string value to match. I work in PowerBuilder but the code will probably work extending other table classes.

Usage:

Integer iCount = MainWindow.MainTable.GetNumberOfMatches(“Columnname”,”SomeValue”)

Zee code:

[-] extend class PbTable
[-] Integer GetNumberOfMatches (String sColumnName, String sValue )
[ ] List <String> ls
[-] for (AppObject ao in this.$(“Row”)[all])
[-] if ( ao.$(sColumnName).GetText( ) == sValue )
[ ] ls.Add(ao.$(sColumnName).GetText())
[ ] return (ls.Count())



   

Quote

Share:

Can’t Find An Answer in the Forum?

Contact Our Team