Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Matrix.Evaluate
Evaluates an expression for each cell.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Matrix | 10.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
MatrixRef | The matrix reference number. | $matrix | |
Expression | The expression to evaluate. Can include "row", "column" and "current" as variables. |
"current +1" | |
firstRow | The index of first row. Default is 0. |
0 | Optional |
lastRow | The index of last row. Default is Matrix.Height-1. |
5 | Optional |
firstCol | The index of first column. Default is 0. |
0 | Optional |
lastCol | The index of last column. Default is Matrix.Width-1. |
6 | Optional |
Flags | Pass 1 to ignore results of expressions and not put them back in matrix. Pass 2 to continue after error (new in 13.5). |
0 | Optional |
Result
Returns OK or error.
Description
Evaluates an expression for each cell.You can change the value by doing a calculation in FileMaker syntax to change the value.
Reference current value via "current", the current row via "row" and the current column via "column" as variable names.
The result of the evaluate is written to the cell.
May return error if expression is invalid.
Examples
Try evaluate:
Set Variable [ $matrix ; Value: MBS("Matrix.New"; 5; 6) ]
# set values
Set Variable [ $r ; Value: MBS("Matrix.SetRow"; $matrix; 0; "Joe¶Miller¶New York¶123") ]
Set Variable [ $r ; Value: MBS("Matrix.SetRow"; $matrix; 1; "Bob¶Jones¶Washington¶234") ]
Set Variable [ $r ; Value: MBS("Matrix.SetRow"; $matrix; 2; "Jane¶Stones¶Los Angeles¶567") ]
# add one to all by expression
Set Variable [ $r ; Value: MBS("Matrix.Evaluate"; $matrix; "current + 1"; 0; 2; 3; 3) ]
# show numbers
Show Custom Dialog [ "Values" ; MBS("Matrix.GetColumn"; $matrix; 3) ]
Set Variable [ $r ; Value: MBS("Matrix.Release"; $matrix) ]
Set each cell to the value and row/column:
Set Variable [ $r ; Value: MBS("Matrix.Evaluate"; $matrix; "current & \" \" & row & \" \" & column"; 0; 3; 3; 3) ]
Continue on error 500 (bad date format) and remove invalid dates:
Let([
m = MBS("Matrix.New"; 7; 2);
s = MBS("Matrix.SetColumn"; m; 0; "10/23/71¶5.4.68¶16.555555¶garbage¶4-8-2003¶50/3/2356¶5.4.68" );
s = MBS("Matrix.SetColumn"; m; 1; "10/23/71¶5.4.68¶16.555555¶garbage¶4-8-2003¶50/3/2356¶5.4.68" );
e = "if ( GetAsText(GetAsDate ( current )) = \"?\" ; \"\" ; GetAsDate ( current ) )";
s = MBS("Matrix.Evaluate"; m; e; 1; 6; 1; 1; 2);
r = MBS("Matrix.Text"; m; ""; ""; ""; ""; ""; " => ")
];r)
Example result:
10/23/71 => 10/23/71
5.4.68 => 05.04.1968
16.555555 =>
garbage =>
4-8-2003 => 04-08-2003
50/3/2356 =>
5.4.68 => 05.04.1968
See also
- Matrix.GetColumn
- Matrix.Height
- Matrix.New
- Matrix.Release
- Matrix.SetColumn
- Matrix.SetRow
- Matrix.Text
- Matrix.Width
Release notes
- Version 13.5
- Added Flags Parmeter for Matrix.Evaluate. Pass 2 to continue after error.
- Improved Matrix.Evaluate and Matrix.Current to work better in multi threading environments.
- Version 11.1
- Fixed parameters for Matrix.Evaluate function.
- Version 10.2
- Added Matrix.Evaluate function.
Blog Entries
- MBS FileMaker Plugin, version 13.5pr1
- MBS FileMaker Plugin, version 11.1pr1
- News about the MBS FileMaker Plugin 10.2
- Neues MBS FileMaker Plugin 10.2
- MBS FileMaker Plugin 10.2 - More than 6200 Functions In One Plugin
- MBS FileMaker Plugin, version 10.2pr2
This function checks for a license.
Created 2nd April 2020, last changed 24th September 2023