This sample code counts the number of rows in your table that have field values that match a value of your choice.
The counted rows are set inside other fields, when you save your record data.
Sample Image
Sample Code
Make sure to match the field codes stated for TABLEDATA, WEATHER, SUNNYCOUNT, CLOUDYCOUNT, RAINYCOUNT with the field codes in your app.
Refer to this page, on how to add scripts to your app.