4 Replies Latest reply on Apr 21, 2010 8:31 PM by icecreamboy

    performing a find...

    icecreamboy

      Title

      performing a find...

      Post

      Hi,

       

      I'm using FileMaker Pro 11 Advanced on Windows XP. So I realized that in Form view, the middle-scroll wheel doesn't scroll up and down the page, but it does in List view, and I find this scrolling to be very convenient.

       

      What I'm trying to do is have a "New Record" button, done in List View, that makes it so the currently found set of records is only the new record. This emulates the Form view, and keeps the scrolling of List view.

       

      I've come up with this script but it keeps saying it can't find any records:

       

      Freeze Window

      Enter Browse Mode []

      New Record/Request

      Commit Records/Requests [No dialog]

      Set Variable [$id; Value:Patients::Patient ID]

      Enter Find Mode []

      Insert Calculated Result [Select; Patients::Patient ID = $id]

      Perform Find []

      Enter Browse Mode []

       

      My logic is, create and commit a new record, get its primary key (Patient ID), perform a find for records with that primary key, and voila, I would think that I just get a List View of my new record.

       

      Could someone please tell me what I'm doing wrong? Any help would be very greatly appreciated! Thanks :)

        • 1. Re: performing a find...
          icecreamboy

          Oops it seems the automatic smiley thing messed up my script above. Just pretend any :P is supposed to be a "colon" with a "P". Sorry about that!

          • 2. Re: performing a find...
            LaRetta_1

             


            icecreamboy wrote:

             

            Insert Calculated Result [Select; Patients::Patient ID = $id]

             

            Could someone please tell me what I'm doing wrong?


             

             

            If you are correct in the exact wording of the Insert Calculated Result line then ...that is your error.

             

            Your calculation asks (in simple-talk):  Does PatientID = $ID?  This is a boolean result of 1 or 0. 

             

            Your script step, when viewing it, should look like: 

             

            Insert Calculated Result [Select; Patients::Patient ID ;  $id ] ... note there is NO equal sign?  You have not entered your PatientID into the target field Specify portion.  YOu instead entered it all into the calculation.  Your calculation should ONLY have  $id in it. :smileyhappy:

             


            • 3. Re: performing a find...
              LaRetta_1

               

               As for your script, how about (untested and always back up first):

               

              Freeze Window

              Show All Records
              Show Omitted Only
              Loop
              Exit Loop If [ not Get ( FoundCount )
              Go To Record/Request/Page [ Last ]
              Omit Record
              End Loop

              New Record/Request

               

              You will have one record in your found set - the one you create.  The reason for the loop is to protect from multi-user mode, ie, if the moment before you 'show omitted only' another User adds a record, it will pop into your record set.  So the loop says, if that happens, omit that record until it is sure you have zero records in your found set.  Then create your new record.

               

              Searching for the new ID works as well but I wouldn't use Insert Calculated Result - it is best to use Set Field[]. 

               



              • 4. Re: performing a find...
                icecreamboy

                Oh okay I understand the first post. And after trying it, I tossed out my script and used yours and it works PERFECTLY! Thank you again, LaRetta :)