06
Apr

Matrix

  • Font size: Larger Smaller
  • Hits: 20976
  • Print

Sometimes you may need to store some auxiliary data that you need to use at your code section. You can store data in form of tables (matrix) that you can recover at any point of your calculation. In order to create a new matrix, select ‘matrix’ option of your calculator, and select ‘new’ .

You must specify a name for your matrix, and a variable to be used at the code.

You can enter the table data adding columns and rows manually or using csv data. We’ll create an example with a small table, that will store two taxes values (rows), depending on a product type we have configured as input field using an option list with values (T1,T2 and T3)

Matrix data is accessed using its variable name and the row-column combination to access each cell, using this sintax:


$matrixname[“row”][“column”]

For this example, if we write the code:


$result= $taxesmatrix["T2"]["Tax2"];


We’ll have the value "8" at 'result variable.
If we have already asked the user to choose from different product types, and we have the value at $option variable, we could use:

$result= $taxesmatrix[$option]["Tax1"];
Or
$result= $taxesmatrix[$option]["Tax2"];

In order to access each column cell.
You can create as many matrix as needed to store auxiliary data you need for your calculations.

Last modified on

Our clients' feedback