3 Replies Latest reply on Jun 7, 2010 9:09 AM by DrLego

    I think this is a simple Script, but cant figure it out

    DrLego

      Title

      I think this is a simple Script, but cant figure it out

      Post

      1. I need to enter find mode and match 3 fields.

      2. If the data entered matches, it needs to go to a different layout and print.  Then return to orig layout.

      3. If the data entered does not match, it needs to pop up a dialog. After ok is hit, back to orig layout,

       

      Can someone let me know how to do this?

       

      Sorry, but I am kinda newbie.

       

      Thanks

       

      Lego

        • 1. Re: I think this is a simple Script, but cant figure it out
          LaRetta_1

          No problem with being new ... we all were at one time or another.

           

          Try something like this:

           

          Go To Layout [ layout based upon the table you are finding in ]

          Enter Find Mode [ uncheck pause ]

          Set Field [ field1 ; yourvalue ]

          Set Field [ field2 ; yourvalue ]

          Set Field [ field3 ; yourvalue ]

          Set Error Capture [ on]

          Perform Find [ ]

          If [ Get ( LastError ) = 401 ]

          # ... 3. data doesn't match

          Show Custom Dialog [ OK ; "No records found." ]

          Go to Layout [ original layout ]

          Halt Script

          End If

          # ... records found

          Go To Layout [ print layout ]

          Print

          Go to Layout [ original layout ]

           

          • 2. Re: I think this is a simple Script, but cant figure it out
            ninja

            Howdy,

             

            LaRetta is right on, but I figured I'd chime in with another option for the test in case it is preferable to you...

             

            Go To Layout [ layout based upon the table you are finding in ]

            Enter Find Mode [ uncheck pause ]

            Set Field [ field1 ; yourvalue ]

            Set Field [ field2 ; yourvalue ]

            Set Field [ field3 ; yourvalue ]

            Set Error Capture [ on]

            Perform Find [ ]

            If [ Get ( LastError ) = 401 ]

            If [ Get(FoundCount) = 0 ]

            # ... 3. data doesn't match

            Show Custom Dialog [ OK ; "No records found." ]

            Go to Layout [ original layout ]

            Halt Script

            End If

            # ... records found

            Go To Layout [ print layout ]

            Print

            Go to Layout [ original layout ]

             

             

            The steps will  do the same thing but I, personally, find the FoundCount test more intuitive.

            It's simply preference, not function...please correct me if this statement in untrue.

            • 3. Re: I think this is a simple Script, but cant figure it out
              DrLego

              You guys rock! 

               

              Thank you!

               

              Worked perfect.

               

              Dr Lego