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.

Finding all possible combinations (permutations) of a set of variables

Featured Replies

  • Newbies

Hi all! I need your help. I'm working on a database that will help me create test ads. Each ad will have several variables to test (headline, tagline, price, etc.) so I am trying to create a script that will generate a record for each set of possible variables (which would be super-great it it actually plugged the variables in). I'm picturing a separate database for each of the variables, but maybe repeating fields would be better? Thanks in advance for your help!

You must mean separate "table" for each variable (not "database"). That's likely the most flexible, and easy to use. Or you could just type them, or extract them, or ?. We (I) don't really know exactly what you're doing, nor where the data is coming from, whether you're "extracting" it from given text, or whether you're "building" it from fixed variables, and what generally is the result supposed to be.

I think there's 2 basic methods to do what you want. There are Custom Functions; which you would need FileMaker Pro Advanced to implement, but would work in FileMaker Pro also. However, they have a 50 thousand recursion limit. So whether you can use them comes down to how many they'd have to process.

Another way to the same result is to build the combos via a script, with nested loops. I did this a while ago; but it was for only 2 parameters (with lots of different values, stock symbols). It can be done. It has no limit. But I don't really know about the nesting. If anyone knows a modular loop method which can handle many variables, chime in.

  • Author
  • Newbies

Thanks for your advice. I think I'm over-complicating the issue. The object is this: I want an Advertisement to be tried with variables of Heading 1, Heading 2, Heading 3 AND with Price 1, Price 2, Price 3 AND with say, Logo 1, Logo 2, Logo 3 - and all possible combinations thereof. All I really need is a script that will give me Heading1+Price1+Logo1, then Heading 2+Price1+Logo1, then Heading3+Price1+Logo1, then starting again with Heading2+Price1+Logo1, etc.

It's not very difficult - but what would be the purpose of having all these combinations?

  • Author
  • Newbies

The purpose would be to test each of the possible combinations for buyer response. I know it sounds a bit anal, but buyers can surprise you. It might turn out that Headline 1 gets the best response when teamed with Logo 3. And I am absolutely sure that FM can do it, but I get so confused when Loops come into play in scripts. There is a post elsewhere on this forum that gives an example for what I want to do, but it's for possible lottery ball combinations, and I'm having trouble straightening that script out in my mind since all the variables are labeled "ball". Thanks so much for your help. You guys and gals are great!

  • Author
  • Newbies

You Rock!!!!! That's exactly what I needed. Thank you so very much :

Here's another example that uses separate tables to hold each of the independent variables.

The table of Logos has a container field for the logo itself. This allows you to create a mock-up of the ad for that combination in a layout.

ad_combinations_fp7.zip

  • Author
  • Newbies

Oh, Tominator - that's just awesome! Thank you so much. Now the scripts are all in a language I understand and I can totally make them work. You all are incredibly generous with your help, and I appreciate it. :)

  • 4 months later...
  • Newbies

This almost solved my problem!

It's just that, in this, example there's a fixed number (3) of parameters (gValuesA, gValuesB and gValuesC).

Mine has an unknown number of parameters, that is:

(gValuesA, gValuesB ... gValuesX), any ideas? All help is very much appreciated! :P

Example:

I have a huge table with records such as:

PC1

HD Size1

HD Size2

Processor1

Processor2

Processor3

Monitor21Inch

Monitor27Inch

Monitor29Inch

Monitor33Inch

PC2

HD Size1

HD Size2

HD Size3

Processor1

Processor2

Monitor21Inch

Monitor27Inch

Color-White

Color-Black

Color-Silver

I need to get all possible combination of specs for PC1 and PC2 given the different configurations available (to eventually check for availability and pricing)

Edited by Guest

I am afraid I don't follow: I see these parameters in your example:

HD size

Processor

Monitor size

Color

What exactly do you want to combine? Processor 1 with Processor 2? Or any processor with any HD size with any monitor, etc.? Please explain in more detail.

Here's a version of your file with a 3 column report added so it could be printed and discussed.

ad_combinations.fp7.zip

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.