Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ListMatrix ( ListOne ; ListTwo ; separator ; counter1 ; counter2 ; result )

Featured Replies

Name & Parameters: [color:red][big] ListMatrix ( ListOne ; ListTwo ; separator ; counter1 ; counter2 ; result ) [/big]

Description: While the FileMaker function "Combinations" predits the amount of combinations from two lists, ListMatrix actually outputs all unique combinations. You can also add a ListOne offset, specify a separator for the values from ListOne and ListTwo, and add a header to the result.

Sample Input:

ListMatrix( "a¶b¶a", "1¶2¶3¶4¶2"; " and "; ""; ""; "Combinations of Alpha and Nums:¶" )

Results:

Combinations of Alpha and Nums:

a and 1

a and 2

a and 3

a and 4

b and 1

b and 2

b and 3

b and 4

Recursive: yes

Formula:

Let( [

numListOne = ValueCount( ListOne );

numListTwo = ValueCount( ListTwo );

counter2 = Case( counter2 < 1; 1; counter2 >= numListTwo; 1; counter2 + 1);

counter1 = Case( counter1 < 1; 1; counter2 = 1; counter1 + 1; counter1 );

result = If( counter1 + counter2 > 2; result & “¶” ) & If( PatternCount( result; ( GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 ) ) ) = 0; ( GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 ) ) )

];

Case( counter1 >= numListOne and counter2 >= numListTwo; result; ListCombiner( ListOne; ListTwo; separator; counter1; counter2; result ))

) 

Required Functions:

Author(s): gephry

Date: 02/06/07

Credits:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

ListMatrix.zip

Edited by Guest
Attachment didn't upload

  • Author

Might as well ask this in the meantime:

I tried to program it so that the only parameters you send to it were ListOne, ListTwo, and separator. But, when defining the custom function it said counter1, counter2, and result were invalid parameters. So, I ended up specifying them as parameters, of which I'd prefer not to.

How can I define this function with those last three variables being internal parameters only (so they do not need to be specified when the function is called)?

  • Author

Whoops, I lied. I must have modified that script so you couldn't add a header to the result as I show in the example. This version of the script however will let you add a header (no ¶ necessary after the header):

Let( [

numListOne = ValueCount( ListOne );

numListTwo = ValueCount( ListTwo );

counter2 = Case( counter2 < 1; 1; counter2 >= numListTwo; 1; counter2 + 1);

counter1 = Case( counter1 < 1; 1; counter2 = 1; counter1 + 1; counter1 );

result = result & "¶" & If( PatternCount( result; ( GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 ) ) ) = 0; ( GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 ) ) )

];

Case( counter1 >= numListOne and counter2 >= numListTwo; result; ListMatrix( ListOne; ListTwo; separator; counter1; counter2; result ))

)

  • 4 weeks later...

Here's an version that lets you use an evaluate statement on the header:

// ListMatrixEval( ListOne; ListTwo; separator; counter1; counter2; result )

Let( [

numListOne = ValueCount( ListOne );

numListTwo = ValueCount( ListTwo );

result = Case(counter2 = "eval"; Evaluate(result); result);

counter2 = Case( counter2 < 1; 1; counter2 >= numListTwo; 1; counter2 + 1);

counter1 = Case( counter1 < 1; 1; counter2 = 1; counter1 + 1; counter1 );

result = result & "¶" &

If(

PatternCount( result; ( GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 ) ) ) = 0;

GetValue( ListOne; counter1 ) & separator & GetValue( ListTwo; counter2 )

)

];

Case( counter1 >= numListOne and counter2 >= numListTwo; result;

ListMatrixEval( ListOne; ListTwo; separator; counter1; counter2; result )

))

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.