Displaying Statistical Information
Tip: See "Computed Fields" if you are looking for information about computed fields.
A "Stats Box" is a different type of computed field which you can place on top of a record list window in order to display some statistical information
about all of the currently displayed records. Its configuration is very similar to a computed field
but it uses a different set of built-in math functions.
You can add more than one stats box. However, keep in mind that SpeedBase will automatically hide stats boxes starting from the most right side
position if there is not enough horizontal space to fit them all. You may consider to resize / maximize the window in that case.
Note that you should type a dot, not comma, when you need to use decimal marks.
In the example picture below, the sum of all payments of the displayed records is calculated by a stats box with an expression of
fieldSum("payment").
Creating / Updating Stats Boxes
- From the catalog tree, right click the catalog name, select "Design Toolbar & Stats" from the popup menu,
This will open "Toolbar Designer"
- Click the button "New Stats Box" (or select an existing one if you want to update),
- Enter an expression into the expression box, save and exit
- A new stats box will be displayed now on top of the record list window.
Box Width: Adjust the width of the output box in pixels.
Label: Enter a descriptive name to be displayed with the stats box.
Align: The stats box can optionally be aligned to the right side of the window.
Invisible: Hide the stats box.
Available functions and examples are given below. Function names are not case sensitive.
Special Functions Dedicated to Stats Boxes
RecordCount
RecordCount ("viewName")
RecordCount ("fieldName", "compareMode", "compareValue")
Returns the number of records existing in the specified view whose name is given in quotes.
RecordCount: Returns the number of records on current view.
RecordCount ("viewName"): Returns the number of records on specified (filtered) view.
RecordCount ("fieldName", "compareMode", "compareValue"): Returns the number of records on current view which conform the specified condition.
You may omit "compareMode" and "compareValue" if the field is a checkbox and you want to count "checked" records.
The following example returns the number of records on current view for which the "category" field was set as "Book":
RecordCount ("Category", "=", "Book")
FieldSum ("sumFieldName")
FieldSum ("sumFieldName", "viewName")
FieldSum ("sumFieldName", "compareFieldName", "compareMode", "compareValue")
Returns the numeric sum of the data on field specified in quotes.
FieldSum (sumFieldName): Returns the sum of the data on specified field of records on current view.
FieldSum ("viewName"): Returns the sum of the data on specified field of records on specified (filtered) view.
FieldSum ("sumFieldName", "compareField", "compareMode", "compareValue"): Returns the sum of the data on specified field on current view which conform the specified condition.
You may omit "compareMode" and "compareValue" if the field is a checkbox and you want to calculate the sum for "checked" records.
Example:
Assume that you have a "Tasks" catalog and you save the time spent for each task into a numeric field named as "Hours".
This expression will show the total hours spent for all tasks listed in current view.
FieldSum("Hours")
Assume that you have a "Expenses" catalog, where you record all expenses into the field name "cost".
Assume also that you have created the view "Expenses in last week" and assigned a filter to it which displays only the records created in last week.
This expression will show the total expense in last week regardless from which view was selected.
FieldSum("cost","Expenses in last week")
The following example returns the total of all prices on current view for which the "category" field was set as "Book":
FieldSum ("Price", "Category", "=", "Book")
FieldAvg("FieldName") or FieldAvg("FieldName","ViewName")
Returns the numeric sum of the field specified in quotes divided by the number of records currently listed.
Used exactly in the same way as FieldSum function.
All other Functions
See Function Reference page for more information.
If you are unsure how to build the right expression, request support.