Component: Matrix 
------------------

Matrix functions to manage a two dimensional array of values.

Use [Matrix.New](MatrixNew.md) or [Matrix.NewWithSQL](MatrixNewWithSQL.md) to create the matrix objects.

| Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|
| [9.2](newinversion92.md "First functions introduced with version 9.2.") / [16.2](newinversion162.md "Newest functions in version 16.2.") | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

  
| Item | Details |
|:--|:--|
| [Matrix.Add](MatrixAdd.md)   Adds a value to cells in matrix. | All   10.2 |
| [Matrix.AddColumn](MatrixAddColumn.md)   Adds one column to a matrix. | All   9.2 |
| [Matrix.AddColumns](MatrixAddColumns.md)   Adds columns to a matrix. | All   9.2 |
| [Matrix.AddRow](MatrixAddRow.md)   Adds a row to the matrix. | All   9.2 |
| [Matrix.AddRows](MatrixAddRows.md)   Adds rows to the matrix. | All   9.2 |
| [Matrix.Append](MatrixAppend.md)   Appends second matrix to first one. | All   15.3 |
| [Matrix.Avg](MatrixAvg.md)   Calculates average value in a matrix column. | All   9.2 |
| [Matrix.CSV](MatrixCSV.md)   Queries text of matrix for CSV export. | All   9.2 |
| [Matrix.CSVSplit](MatrixCSVSplit.md)   Splits CSV text. | All   10.5 |
| [Matrix.Clear](MatrixClear.md)   Clears the matrix. | All   9.2 |
| [Matrix.ClearValues](MatrixClearValues.md)   Clears all values in the matrix. | All   9.2 |
| [Matrix.Clone](MatrixClone.md)   Creates a copy of a matrix. | All   9.2 |
| [Matrix.ConvertDataType](MatrixConvertDataType.md)   Converts the data types. | All   12.5 |
| [Matrix.CopyColumn](MatrixCopyColumn.md)   Copies a column from one (or same) matrix to another column. | All   10.2 |
| [Matrix.CopyContent](MatrixCopyContent.md)   Copies the content of a matrix into another matrix. | All   15.3 |
| [Matrix.CopyRow](MatrixCopyRow.md)   Copies a row from one (or same) matrix to another row. | All   10.2 |
| [Matrix.DataType](MatrixDataType.md)   Queries data type of a value. | All   9.2 |
| [Matrix.Evaluate](MatrixEvaluate.md)   Evaluates an expression for each cell. | All   10.2 |
| [Matrix.GetColumn](MatrixGetColumn.md)   Queries text of a whole column. | All   9.2 |
| [Matrix.GetColumnName](MatrixGetColumnName.md)   Queries column name. | All   10.2 |
| [Matrix.GetColumnNames](MatrixGetColumnNames.md)   Queries column names. | All   10.2 |
| [Matrix.GetRow](MatrixGetRow.md)   Queries text of a whole row. | All   9.2 |
| [Matrix.GetRowName](MatrixGetRowName.md)   Queries row name. | All   10.2 |
| [Matrix.GetRowNames](MatrixGetRowNames.md)   Queries row names. | All   10.2 |
| [Matrix.GetText](MatrixGetText.md)   Queries text of whole matrix. | All   9.2 |
| [Matrix.GetValue](MatrixGetValue.md)   Queries a single value. | All   9.2 |
| [Matrix.HTML](MatrixHTML.md)   Queries html of matrix. | All   13.3 |
| [Matrix.Height](MatrixHeight.md)   Queries height of matrix. | All   9.2 |
| [Matrix.IndexOfFirstValueMatching](MatrixIndexOfFirstValueMatching.md)   Finds index of first value matching value. | All   14.0 |
| [Matrix.InsertColumn](MatrixInsertColumn.md)   Inserts one column into a matrix. | All   15.3 |
| [Matrix.InsertOrUpdateRecords](MatrixInsertOrUpdateRecords.md)   Insert or updates a lot of records queried from a database. | All   16.1 |
| [Matrix.InsertOrUpdateRecordsToSQL](MatrixInsertOrUpdateRecordsToSQL.md)   Insert or updates a lot of records queried from a database. | All   16.1 |
| [Matrix.InsertRecords](MatrixInsertRecords.md)   Inserts records in FileMaker database from records in memory. | All   9.2 |
| [Matrix.InsertRecordsToSQL](MatrixInsertRecordsToSQL.md)   Inserts records in SQL database from records in memory. | All   9.2 |
| [Matrix.InsertRow](MatrixInsertRow.md)   Inserts one row into a matrix. | All   15.3 |
| [Matrix.JSONRecord](MatrixJSONRecord.md)   Returns a row as JSON object. | All   9.2 |
| [Matrix.JSONRecords](MatrixJSONRecords.md)   Returns rows as JSON array. | All   9.2 |
| [Matrix.List](MatrixList.md)   Lists all IDs of current Matrix objects. | All   12.5 |
| [Matrix.Lookup](MatrixLookup.md)   Queries value without errors. | All   13.5 |
| [Matrix.MBS](MatrixMBS.md)  **New in 16.2**    Calls a MBS function with parameters from the matrix. | All   16.2 |
| [Matrix.Max](MatrixMax.md)   Queries max value in a matrix column. | All   9.2 |
| [Matrix.Min](MatrixMin.md)   Queries min value in a matrix column. | All   9.2 |
| [Matrix.Multiply](MatrixMultiply.md)   Multiplies a value with cells in matrix. | All   10.3 |
| [Matrix.New](MatrixNew.md)   Creates a new matrix (2D array). | All   9.2 |
| [Matrix.NewWithSQL](MatrixNewWithSQL.md)   Execute the SQL Statement against a FileMaker database. | All   9.2 |
| [Matrix.Release](MatrixRelease.md)   Frees the matrix object. | All   9.2 |
| [Matrix.ReleaseAll](MatrixReleaseAll.md)   Releases all matrix objects. | All   10.5 |
| [Matrix.RemoveColumn](MatrixRemoveColumn.md)   Removes a column. | All   9.2 |
| [Matrix.RemoveRow](MatrixRemoveRow.md)   Removes a row. | All   9.2 |
| [Matrix.Resize](MatrixResize.md)   Resizes matrix to given height and width. | All   9.2 |
| [Matrix.Rotate](MatrixRotate.md)   Rotates a matrix. | All   12.4 |
| [Matrix.SearchAndReplace](MatrixSearchAndReplace.md)  **New in 16.2**    Searches and replaces text. | All   16.2 |
| [Matrix.SetColumn](MatrixSetColumn.md)   Sets a column to the given texts. | All   9.2 |
| [Matrix.SetColumnName](MatrixSetColumnName.md)   Sets column name. | All   10.2 |
| [Matrix.SetColumnNames](MatrixSetColumnNames.md)   Sets column names. | All   12.5 |
| [Matrix.SetRow](MatrixSetRow.md)   Sets a row to the given texts. | All   9.2 |
| [Matrix.SetRowName](MatrixSetRowName.md)   Sets row name. | All   10.2 |
| [Matrix.SetRowNames](MatrixSetRowNames.md)   Sets row names. | All   12.5 |
| [Matrix.SetValue](MatrixSetValue.md)   Sets a single value in the matrix. | All   9.2 |
| [Matrix.Sum](MatrixSum.md)   Calculates sum value in a matrix column. | All   9.2 |
| [Matrix.SwapColumns](MatrixSwapColumns.md)  **New in 16.2**    Swaps two columns in the matrix. | All   16.2 |
| [Matrix.SwapRows](MatrixSwapRows.md)  **New in 16.2**    Swaps two rows in the matrix. | All   16.2 |
| [Matrix.Text](MatrixText.md)   Queries text of matrix. | All   9.2 |
| [Matrix.Width](MatrixWidth.md)   Queries width of matrix. | All   9.2 |

64 functions shown.

These functions require a license (91%).

### Release notes

- **Version 16.2**
    - Added [Matrix.MBS](https://www.mbsplugins.eu/MatrixMBS.shtml) function to call a MBS function with taking parameters from the matrix.
    - Added [Matrix.SearchAndReplace](https://www.mbsplugins.eu/MatrixSearchAndReplace.shtml), [Matrix.SwapColumns](https://www.mbsplugins.eu/MatrixSwapColumns.shtml) and [Matrix.SwapRows](https://www.mbsplugins.eu/MatrixSwapRows.shtml) functions.
- **Version 16.1**
    - Added [FM.SQL.InsertOrUpdateRecords](https://www.mbsplugins.eu/FMSQLInsertOrUpdateRecords.shtml) and [Matrix.InsertOrUpdateRecords](https://www.mbsplugins.eu/MatrixInsertOrUpdateRecords.shtml) functions.
    - Added [FM.SQL.InsertOrUpdateRecordsToSQL](https://www.mbsplugins.eu/FMSQLInsertOrUpdateRecordsToSQL.shtml) and [Matrix.InsertOrUpdateRecordsToSQL](https://www.mbsplugins.eu/MatrixInsertOrUpdateRecordsToSQL.shtml) functions.
    - Improved [Matrix.InsertRecordsToSQL](https://www.mbsplugins.eu/MatrixInsertRecordsToSQL.shtml) and [FM.SQL.InsertRecordsToSQL](https://www.mbsplugins.eu/FMSQLInsertRecordsToSQL.shtml) functions to pass NULL if a number or date field is empty. Otherwise SQL would complain about passing invalid date or number.
    - Rewrote [FM.SQL.InsertRecords](https://www.mbsplugins.eu/FMSQLInsertRecords.shtml) and [Matrix.InsertRecords](https://www.mbsplugins.eu/MatrixInsertRecords.shtml) functions to use same code internal.
    - Rewrote [FM.SQL.InsertRecordsToSQL](https://www.mbsplugins.eu/FMSQLInsertRecordsToSQL.shtml) and [Matrix.InsertRecordsToSQL](https://www.mbsplugins.eu/MatrixInsertRecordsToSQL.shtml) functions to use same code internal.
- **Version 15.4**
    - Added DetectJSON flag to [Matrix.JSONRecord](https://www.mbsplugins.eu/MatrixJSONRecord.shtml) and [Matrix.JSONRecords](https://www.mbsplugins.eu/MatrixJSONRecords.shtml).
- **Version 15.3**
    - Added [Matrix.Append](https://www.mbsplugins.eu/MatrixAppend.shtml) function.
    - Added [Matrix.InsertRow](https://www.mbsplugins.eu/MatrixInsertRow.shtml) and [Matrix.InsertColumn](https://www.mbsplugins.eu/MatrixInsertColumn.shtml) functions.
- **Version 14.4**
    - Fixed a bug with [Matrix.Text](https://www.mbsplugins.eu/MatrixText.shtml) function where it would skip some columns if they were constants in SQL used to create the matrix.
- **Version 14.3**
    - Added header row flag for [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) to put first row into column names.
    - Changed [Matrix.CSVSplit](https://www.mbsplugins.eu/MatrixCSVSplit.shtml) to handle CSV with multi line values better.
    - Changed [Matrix.JSONRecord](https://www.mbsplugins.eu/MatrixJSONRecord.shtml) and [Matrix.JSONRecords](https://www.mbsplugins.eu/MatrixJSONRecords.shtml) to take field names from column names, if you have some and you don't pass field names.
- **Version 14.2**
    - Added firstRow and lastRow parameter to [Matrix.JSONRecords](https://www.mbsplugins.eu/MatrixJSONRecords.shtml) function.
    - Added flag 16 for [Matrix.JSONRecords](https://www.mbsplugins.eu/MatrixJSONRecords.shtml) to include field names as first row if outputting arrays.
    - Improved [Matrix.HTML](https://www.mbsplugins.eu/MatrixHTML.shtml) and [JSON.ToHTML](https://www.mbsplugins.eu/JSONToHTML.shtml) to use CSS for right alignment.
- **Version 14.0**
    - Added CSS parameter for [Matrix.HTML](https://www.mbsplugins.eu/MatrixHTML.shtml) function.
    - Added [Matrix.IndexOfFirstValueMatching](https://www.mbsplugins.eu/MatrixIndexOfFirstValueMatching.shtml) function.
    - Fixed a problem in [Matrix.CopyRow](https://www.mbsplugins.eu/MatrixCopyRow.shtml) when using row names.
- **Version 13.5**
    - Added Flags Parameter for [Matrix.HTML](https://www.mbsplugins.eu/MatrixHTML.shtml) function.
    - Added Flags Parmeter for [Matrix.Evaluate](https://www.mbsplugins.eu/MatrixEvaluate.shtml). Pass 2 to continue after error.
    - Added [Matrix.Lookup](https://www.mbsplugins.eu/MatrixLookup.shtml) function to get a value without error for invalid parameters.
    - Improved [Matrix.Evaluate](https://www.mbsplugins.eu/MatrixEvaluate.shtml) and Matrix.Current to work better in multi threading environments.

### Blog Entries

- [MBS FileMaker Plugin 16.2 News](https://www.mbsplugins.de/archive/2026-05-20/MBS_FileMaker_Plugin_162_News/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 16.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/MBS_Plugin_162_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 16.1 News](https://www.mbsplugins.de/archive/2026-03-31/MBS_FileMaker_Plugin_161_News/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 4 - FM.SQL.Executeand life in the matrix](https://www.mbsplugins.de/archive/2025-12-04/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 15.3 for Claris FileMaker](https://www.mbsplugins.de/archive/2025-07-15/MBS_Plugin_153_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS @ dotfmp 2024](https://www.mbsplugins.de/archive/2024-06-17/MBS_@_dotfmp_2024/monkeybreadsoftware_blog_filemaker)
- [ISO FileMaker Magazine: Copy, Paste &amp; Import Spreadsheet Data](https://www.mbsplugins.de/archive/2024-05-03/ISO_FileMaker_Magazine_Copy_Pa/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 14.0](https://www.mbsplugins.de/archive/2024-01-23/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.3 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-07-18/MBS_Plugin_133_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 12.5 for Claris FileMaker - More than 6800 Functions In One Plugin](https://www.mbsplugins.de/archive/2022-11-08/MBS_Plugin_125_for_Claris_File/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 24 bis 25](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)
- [Ausgabe 4/2019, Seite 29 bis 31](https://filemaker-magazin.de/neuigkeit/4053-Appetithappen-FMM_201904)

### Example Databases

- [SQL in FileMaker/Insert or Update Tests](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20in%20FileMaker/Insert%20or%20Update%20Tests.shtml#1Button21.0000000204.000000052.0000000457.0000000LayoutObjectAnchor_)
- [SQL to other databases/SQLite fun](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/SQLite%20fun.shtml#10ScriptAnchor_)
- [XL/XL Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/XL/XL%20Test.shtml#4ScriptAnchor_)

[HTML Version](component_Matrix.shtml)