Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  

Matrix.Evaluate

Evaluates an expression for each cell.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Matrix 10.2 Yes Yes Yes Yes Yes
MBS( "Matrix.Evaluate"; MatrixRef; Expression { ; firstRow; lastRow; firstCol; lastCol; ReadOnly } )   More

Parameters

Parameter Description Example value
MatrixRef The matrix reference number. $matrix
Expression The expression to evaluate.
Can include "row", "column" and "current" as variables.
"current +1"
firstRow Optional
The index of first row.
Default is 0.
0
lastRow Optional
The index of last row.
Default is FM.SQL.RowCount-1.
5
firstCol Optional
The index of first column.
Default is 0.
0
lastCol Optional
The index of last column.
Default is FM.SQL.FieldCount-1.
6
ReadOnly Optional
Pass 1 to ignore results of expressions and not put them back in matrix.
0

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; 3; 3; 3) ]

# show numbers
Show Custom Dialog [ "Values" ; MBS("Matrix.GetColumn"; $matrix; 3) ]
Set Variable [ $r ; Value: MBS("Matrix.Free"; $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) ]

See also

Blog Entries

Release notes

Created 2nd April 2020, last changed 16th April 2020


Matrix.DataType   -   Matrix.Free

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins