Multidimensional Arrays

Idea created by golife on Nov 12, 2015

    We already use 1-dimensional arrays using key-value pairs in the form $myVariable[$i] where $i is a variable and $myVariable as well, or it could be a repeating field.


    There are many situations where there is a need using multidimensional arrays.


    Let us think of a 2-dimensional array:


    Example data of an array. The semicolon here is only used to illustrate. It does not exist in the array as a delimiter.


    Car ; on stock ; sold

    BMW; 12 ; 18

    Volvo; 3 ; 7

    Land Rover ; 9; 3


    Instead of using different variables for each key-value pair, in a 2-dimensional array we would use for example a global variable:


    $$myVariable [$i] [$j]


    Looking for $i = 2 and $j = 3 we would get 18  ...   $$myVariable [2] [3]  = 18


    Setting and getting such values is as easy as using a 1-dimensional key-value pair as we are doing now.


    It is really standard in all languages using such multidimensional arrays.


    This means, we would be able to get and set data of more than one field at a time. Or we would use results from executeSQL turning them into an array including binary data, numbers, text, dates and time.


    We should be able to search for text values inside arrays, sort arrays if based on numbers of text, and have all the getting and setting functionality. An array could also be used to import data, export data, create many records with one command, filtering records and whatever one might think about within the limits of FileMaker.


    There could then also be a new field type "Table" which would allow to display the array in other ways than creating records. It would be a multiple row table with more than one column. The table would otherwise behave like a field, but contain several columns. Throwing such array into the table would display it automatically in a different way than setting fields of records.