2 Replies Latest reply on Nov 14, 2011 1:23 AM by NorbertKowalski

    Accessing only records matching a variable

    NorbertKowalski

      Title

      Accessing only records matching a variable

      Post

      First of all, I’ll admit to being FM newbie. However, I tried to find a solution to my prolem using google, checking the technet and other means. I was not successful, so I have to ask here.

       

      Let’s start with simplified descrition of my database:

      I have three tables, each contains a field named event_id, and other unrelated fields.

      Fourth table is named events, and contains unique event _id and description. All three tables have a relation on event_id with events table.

      At startup I have a dropdown menu with list of events, and on selecting one item from list I am setting a global variable $$event_id.

       

      Now, what I need to do is to in layouts I need to accesss only records that have event_id equal to $$event_id. I managed to get a similar result using script trigger (function name may not match the real one, as I am not using english filemaker):

      onLayoutEnter:
      search records (table::event_id: [==$$event_id]

       

      onLayoutExit:

      show all records

       

      However, using this solution users see that the results are filtered, and can use show all records button to disable the filtering.

       

      So, what I need is either a way to access only the records matching the global variable without using filtering (prefered solution, as it allows to filter within those records), or to disable the show_all button and the filtering indicator.

       

      I am using Filemaker Pro Advanced 11. 

        • 1. Re: Accessing only records matching a variable
          philmodjunk

          With FileMaker Advanced, you can install a custom menu that does not have the Show All Records and Show Omitted Only options that can defeat your filtering. When you use a custom menu to remove an item from the menu, you also disable its keyboard shortcut.

          You can also create scripts for Show All and Show Omitted Only that replace the standard action in the menu and which Show All or Show Omitted, but then filters down to just the records matching the ID in the variable.

          You can also use the OnModeExit Trigger to constrain the found set whenever the user enters browse mode. This can allow the user to perform finds, but the system then automatically filters out the records that don't match the currently specified ID number.

          You can also use Manage | Security settings to limit the records that are accessible to the ID specified in the global variable. In this case, finds performed by the user will automatically filter to show just the permitted records. Show All and Show Omitted will, unless you modify the menu, still show record not matching the specified ID number, but they will be covered by "access denied" shields keeping the user from accessing that specific record.

          • 2. Re: Accessing only records matching a variable
            NorbertKowalski

            Thank you. So it is more or less like I thought it would have to be done.

            I hoped there would be a build in function like prefilter_results(field: value);

            Well, seems it is time to go into scripting.