Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
FM.SQL.Sum
Calculates sum value in a record set.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL | 9.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
SQLref | The reference number returned by FM.SQL.Execute function. | $SQLRef | |
Column | The index of the column. Default is 0. |
0 | |
firstRow | The index of first row. Default is 0. |
0 | Optional |
lastRow | The index of last row. Default is FM.SQL.RowCount-1. |
5 | Optional |
Result
Returns number or error.
Description
Calculates sum value in a record set.You got a record set in memory and we can walk over a column in a given row range to add the sum value.
Examples
Query once and make several calculations:
# let FileMaker query data once
Set Variable [ $Records ; Value: MBS( "FM.SQL.Execute"; Get(FileName); "SELECT Price FROM Produkte") ]
# Now get sum, min, max and avg
Set Variable [ $sum ; Value: MBS( "FM.SQL.Sum"; $records; 0) ]
Set Variable [ $min ; Value: MBS( "FM.SQL.Min"; $records; 0) ]
Set Variable [ $max ; Value: MBS( "FM.SQL.Max"; $records; 0) ]
Set Variable [ $avg ; Value: MBS( "FM.SQL.Avg"; $records; 0) ]
Set Variable [ $text ; Value: MBS( "FM.SQL.Text"; $records; "" /* firstRow */; "" /* lastRow */; "" /* firstCol */; "" /* lastCol */; ", " /* rowSep */) ]
Set Variable [ $r ; Value: MBS( "FM.SQL.Release"; $records ) ]
Show Custom Dialog [ "Sum: " & $sum & ¶ & "Min: " & $min & ¶ & "Max: " & $max & ¶ & "Avg: " & $avg & ¶ & "text: " & $text ]
See also
- FM.SQL.Avg
- FM.SQL.Execute
- FM.SQL.Max
- FM.SQL.Min
- FM.SQL.Release
- FM.SQL.RowCount
- FM.SQL.Text
- SQL.Execute
Release notes
- Version 9.1
- Added FM.SQL.Max, FM.SQL.Min, FM.SQL.Avg and FM.SQL.Sum functions.
Blog Entries
- Neues MBS FileMaker Plugin 9.1
- MBS FileMaker Plugin 9.1 - More than 5700 Functions In One Plugin
- MBS FileMaker Plugin, version 9.1pr1
- FileMaker SQL with Sum, Min, Max and Avg on results
This function checks for a license.
Created 30th January 2019, last changed 26th February 2021