| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
Matrix.Text
Queries text of matrix.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| Matrix | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Matrix.Text"; MatrixRef { ; FirstRow; LastRow; firstCol; lastCol; rowSeparator; colSeparator; Flags } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| MatrixRef | The matrix reference number. | $matrix | |
| 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 |
| rowSeparator | The row separator. Default is CR. Can be more than one character. |
Char(13) | Optional |
| colSeparator | The column separator. Default is tab character. Can be more than one character. |
Char(9) | Optional |
| Flags | Various flags. 2: Include column names in first row. |
0 | Optional Added in version 13.1. |
Result
Returns text or error.
Description
Queries text of matrix.You can use this method to quickly get all values in a given area as text.
This joins the values and removes text formatting.
Examples
Get a SQL result as CSV text:
Set Variable [ $matrix ; Value: MBS( "Matrix.NewWithSQL"; ""; "SELECT FirstName, LastName, City FROM Contacts" ) ]
# all rows and columns, CR between rows, semicolon between columns
# flag 2 adds the column names as first row
Set Variable [ $csv ; Value: MBS( "Matrix.Text"; $matrix; 0; MBS( "Matrix.Height"; $matrix ) - 1; 0; MBS( "Matrix.Width"; $matrix ) - 1; Char(13); ";"; 2 ) ]
Set Variable [ $r ; Value: MBS( "Matrix.Release"; $matrix ) ]
# all rows and columns, CR between rows, semicolon between columns
# flag 2 adds the column names as first row
Set Variable [ $csv ; Value: MBS( "Matrix.Text"; $matrix; 0; MBS( "Matrix.Height"; $matrix ) - 1; 0; MBS( "Matrix.Width"; $matrix ) - 1; Char(13); ";"; 2 ) ]
Set Variable [ $r ; Value: MBS( "Matrix.Release"; $matrix ) ]
See also
- Dictionary.ToMatrix
- Matrix.Evaluate
- Matrix.GetText
- Matrix.Height
- Matrix.List
- Matrix.New
- Matrix.NewWithSQL
- Matrix.Release
- Matrix.Rotate
- Matrix.Width
Release notes
- Version 16.6
- Improved Matrix.Avg, Matrix.CSV, Matrix.JSONRecords, Matrix.Max, Matrix.Min, Matrix.Multiply, Matrix.Sum and Matrix.Text to not report an error for empty result sets.
- Version 14.4
- Fixed a bug with Matrix.Text function where it would skip some columns if they were constants in SQL used to create the matrix.
- Version 13.1
- Added flags parameter to Matrix.Text function and a flag for Matrix.CSV and Matrix.Text to include column names in first row.
Blog Entries
This function checks for a license.
Created 8th April 2019, last changed 6th November 2026
MarkDown version: MatrixText.md