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.

Find set of records based on common value list items in related table

Featured Replies

Hello everyone,

First off please bear with me as it's been a while since I was tasked to do anything with FMP, so I'm a bit rusty... not that I have any formal training, but I used to be much better at it and I am trying get my mind back in shape!

I am working on a solution that invoices customers for booth rentals at yearly trade shows. Many customers attend the same shows year after year. It consists of these linked files:

  • Customers are in a table named "The New World!" (note the exclamation point) in a file named "The New World"
  • Shows are in a table named "Show Names" in the file named "The New World"
  • Invoices are in a table named "WWE Invoices" in a file named "WWE Invoices"

Here are the relationships:

screen-grab-2023-10-26at1_59_24PM.thumb.jpg.047de359fa6a0d30e6697bd50f3c9863.jpg

I have successfully created a layout that lets the user choose any four prior shows and an upcoming show using a value list of show abbreviations from the WWE Invoices file (S19= Spring '19, F23=Fall '23, etc.). This works to find all customers who have attended any one of the prior chosen shows but not yet signed up for the upcoming show.

screen-grab-2023-10-26at5_44_28PM.thumb.jpg.b281b7aaeead4220d13e73fd58c41696.jpg

When they select the shows they are creating these global variables in the background:

screen-grab-2023-10-26at5_46_20PM.jpg.ace62540d2eae9acd5d968bec487acea.jpg

The script then works like this:

screen-grab-2023-10-26at5_35_07PM.thumb.jpg.fc35c6ba18bb75fe9345f3b5779ec0a3.jpg

So that's all well and good. But now I've been asked to make a similar report that looks for customers who have attended not just any one of the chosen prior shows, but ALL of them, and this is where I'm stuck. If I haven't given you enough to go by, please guide me!

Thanks!
Vince

Edited by macmasterservices

To find customers that have attended all of the shows in the 4 variables, try making your script along the lines of:

Go to Layout [ Customers ]
Enter Find Mode []
Set Field [ Invoices::ShowAbbreviation; $$previousShow ]
Perform Find []

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow2 ] 
Constrain Found Set [ ]

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow3 ] 
Constrain Found Set [ ]

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow4 ] 
Constrain Found Set [ ]

I haven't tested this, but I suspect this requires all 4 variables to be populated. If that's not always the case, you may have to wrap each additional find in an If clause - or (preferably, IMHO) use a single variable to store a return-delimited list of the selected shows, and have your script loop over the list.

Note that there's no need to show all records before performing a find. 

 

 

  • Author
11 hours ago, comment said:

To find customers that have attended all of the shows in the 4 variables, try making your script along the lines of:

Go to Layout [ Customers ]
Enter Find Mode []
Set Field [ Invoices::ShowAbbreviation; $$previousShow ]
Perform Find []

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow2 ] 
Constrain Found Set [ ]

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow3 ] 
Constrain Found Set [ ]

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$previousShow4 ] 
Constrain Found Set [ ]

I haven't tested this, but I suspect this requires all 4 variables to be populated. If that's not always the case, you may have to wrap each additional find in an If clause - or (preferably, IMHO) use a single variable to store a return-delimited list of the selected shows, and have your script loop over the list.

Note that there's no need to show all records before performing a find. 

 

 

OK thanks for that tip, it now works! See this:

screen-grab-2023-10-27at9_35_10AM.jpg.b98aea6e07be07750f6fd3e9596bfeeb.jpg

Edited by macmasterservices

Watch out for the last Set Field step: it's performed in Browse mode, which is not what you want to do when finding records. If you're using stored find requests, then all you need is the Constrain Found Set step. Like many other developers, I usually prefer to do:

Enter Find Mode [ ]
Set Field [ Invoices::ShowAbbreviation; $$currentShow ] 
Omit Record
Constrain Found Set [ ]

because then you can easily see what the script does, without having to delve into the stored requests details.

 

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.