Brian Dunning's FileMaker Custom Functions

CreateConstantMatrix (

Creates a matrix of size (Rows, Columns) with a ConstantValue for each element (each element is followed by a semi-colon).

  Average rating: 4.6 (32 votes) Log in to vote

Dr. Ronald W. Satz   Dr. Ronald W. Satz - Show more from this author
Transpower Corporation
http://www.transpowercorp.com

Share on Facebook Share on Twitter

  Sample input:
( "" ; 2 ; 8 ; 0 ; 0 ; 5 )

  Sample output:
5; 5; 5; 5; 5; 5; 5; 5;
5; 5; 5; 5; 5; 5; 5; 5;

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function is used in preparation for Transpower Corporation's SetCell custom function, also listed here on Brian Dunning's site. Once CreateConstantMatrix is run (which sets up the default values of the elements), SetCell can be run to populate the matrix with the non-default values.

The CreateConstantMatrix should be called with a null value for the matrix name (" ") and with 0 values for the row and column counters.

In the sample input, the matrix is to have 2 rows with 8 columns, all having the value of 5. The SetCell custom function can then set each element to its proper value. Note: The CreateConstantMatrix does NOT add a paragraph return at the end, so it's necessary to delete the "1 + " in the calculation for tot_rows in SetCell!

Update (06/30/2012): fixed bug in creating single column matrix

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: