3 Replies Latest reply on Feb 16, 2017 2:14 PM by lozzib

    I want to omit records based on the info entering into a field

    lozzib

      I am making a mouse database for my research lab. I want to write a script to omit the records of all the dead mice so we don't constantly have to scroll through them. Right now I have a field called status with a drop down box to choose dead or alive. If the status = dead I want the records to be omitted in the list view.

       

      I tried to set up a trigger script so that as soon as the page is accessed the records are omitted, but it doesn't work.

       

      I am new to FileMaker and still not really sure how everything works.

        • 1. Re: I want to omit records based on the info entering into a field
          philmodjunk

          I tried to set up a trigger script so that as soon as the page is accessed the records are omitted, but it doesn't work.

          The script that you show only omits a single record if it is for a dead mouse. You could link that script to an OnObjectModify script trigger set up on your status field to omit the current mouse record at the time that you change its status, but you'd need a different script to omit all mouse records at the time you enter the layout.

           

          Here's a script for that:

          Enter Find Mode [pause:off]

          Set Field [RecordsConverted::Status ; "Alive"]

          Set Error Capture [on]

          Perform Find [ ]

          Sort Records [no dialog ; Restore ] ---> this step and the next are optional

          Go to Record/Request/Page [first]

           

          You could also set up the OnModeEnter trigger to perform the following script every time the layout enters Browse Mode:

          Enter Find Mode [pause:off]

          Set Field [RecordsConverted::Status ; "Alive"]

          Set Error Capture [on]

          Constrain Found Set [ ]

          Sort Records [no dialog ; Restore ] ---> this step and the next are optional

          Go to Record/Request/Page [first]

           

          That way, any find performed by a script or manually by a user on this layout is automatically filtered down to just Mouse Records with the status "Alive".

           

          Note that I am assuming that this layout is based on the RecordsConverted table occurrence.

           

          Yet another option would be to use a portal to list your mouse records and then either the portal relationship or a portal filter could exclude records with a status of "Dead".

          • 2. Re: I want to omit records based on the info entering into a field
            keywords

            The script you have written will only work on the first record. You could make it scroll through the set by making it a looping script, but probably far easier would be to perform a script that simply finds all the live mice:

             

            Enter Find Mode [ ]
            Set Field [ converted::Status; "Dead" ]

            Perform Find [ ]

             

             

            • 3. Re: I want to omit records based on the info entering into a field
              lozzib

              That worked perfectly thank you soooo much!!!!