8 Replies Latest reply on Sep 26, 2013 1:58 PM by philmodjunk

    Perform Find on a Portal



      Perform Find on a Portal


           Hi Everyone

           I'm still learning FileMaker Pro and need some help doing a "Perform Find" on a portal.

      Product:  FileMaker Pro Advanced 12.0v4

      OS:  Mac OSX version 10.8.5

      Tables:  The Contacts table relates to a Participants table which relates to the Events table.  People who join Events are listed in the Participants table.  There's also the EventsAll table which shows all Events.

      Overview:  I'm creating a layout (Mailing Selections) that shows all the Events (EventsAll) within a portal (EventsPortal).  Basically, the EventsAll table has an EventDate and the Event (short Event description) and SelectEvent fields.  These fields are shown in the portal (please see image below).

           The SelectEvent field is shown as a checkbox with values of 1 and 0 and only the 1 value is shown and a tiny script which allows to toggle the selection on and off.

      Desired Affect:  Once the user selects one or more check boxes and presses the Go button, I would like all related records on the Participants table to be returned on a new layout (Mailing Results) in a list view.

      Issue:  I have successfully done this type of logic with Checkbox field with a "US States" value list and look up related contacts with the States chosen (States script shown in image below).

           Unfortunately I'm having difficulty understanding how to do the same thing using a portal.  My script returns all rows from the Contacts table.  I only wish to have those chosen from the portal's records, marked with an X in the SelectEvent field.

           Hope this all makes sense. :-)






        • 1. Re: Perform Find on a Portal

               Woe... image came out really small... let me try that again separately.


          • 2. Re: Perform Find on a Portal

                 states script


            • 3. Re: Perform Find on a Portal

                   States results, which works great!

              • 4. Re: Perform Find on a Portal

                     EventsAll Portal, which populates correctly.


                • 5. Re: Perform Find on a Portal

                       Here's the script with portals that I'm trying to make work.


                  • 6. Re: Perform Find on a Portal

                         First, a key question: Is there even the tiniest chance that this database might be hosted over a network and two different users might be selecting events at the same time?

                         If so, the checkbox selections made by one user will interfere with those made by the other. There is a way to avoid that issue but it requires changes that affect the rest of the solution so I need that answer before I can proceed.

                         Note: there are quite a number of issues with your script as written.

                         In find mode, all non-global fields are empty except for any entered search criteria so you have a number of steps that are referencing empty fields instead of the data you are expecting to be present in those fields. That data has to be moved into global fields or variable before entering find mode so that you can use the data in the variables or global fields to create your find criteria.

                         And ValueCount ( DateField ) will only return a value of 1 if there is a date in the field or 0 if it is empty, it's not going to give you the number of rows in your portal. Count( ) is the function that you can use for that.

                    • 7. Re: Perform Find on a Portal

                           Thank you for your reply.  I do wish to follow through on this and learn more about portals, but the client has decided not to proceed with this particular layout feature at this time.

                           This will give me more time to study up on FileMaker Pro and especially portals.  I'm so green when it comes to portals.

                           To answer your question, yes, this will be hosted over a network and there will be 2 users.  But for now, I need to wrap my head around the whole Find Mode principle.  It's not something I'm use to yet.

                           Again, many thanks for your expertise!

                      • 8. Re: Perform Find on a Portal

                             Then I'll just briefly outline a method for temporarily selecting records that provides each user with their own list and keeps each user's selections from interfering with the other's:

                             Instead of a check box field, put a button in the row (portal or list view layout ) to perform a script for selecting/deselecting a record. The script adds or deletes the Primary key value of the record clicked to/from a return separated list of values stored in a global variable or global field. (Values in variables and global fields are kept separate for each user.)

                             Then a conditional format expression can compare the primary key of the current record with this list of selected ID's and show a visible change when the ID of the current record is a member of the list. By changing font sizes, this conditional format can even change font sizes to make text such as the letter X or a ding bat font's "tick mark" appear and disappear as needed to give your users a "Check box" type look and feel.

                             Your find script, which can then be very similar to your "states" script, can then use this list to find records. And another option if you use a global field, is to set up a relationship that uses the global field as a match field to either display the list in a portal or to use Go To Related Records to bring up that list as a found set on a layout.

                             If you haven't seen it already, you may find this thread of scripted find examples useful: Scripted Find Examples