3 Replies Latest reply on Oct 26, 2011 9:04 AM by philmodjunk

    Stop script from continuing if field is left empty. Help.

    PaddyCakes

      Title

      Stop script from continuing if field is left empty. Help.

      Post

      Hi everyone, 

      The "original file" (the customer file) evokes the script from "current file" in the script below.

      The "current file" is responsible for tracking which images the customer has viewed.

      The image_ID field in the "current file" is selected (drop down list) from a third file "Images" containing the Image particulars.

      I am trying to disallowing the script from continuing unless the Image_ID is not empty.

      The below script works except, if the user has left the Image_ID field empty, then selects "Try Again"and then, for a second time, leaves the Image_ID field empty, selects continue, the script continues, allowing an empty Image_ID field.

      How can I disallow this script from continuing unless the Image_ID is not empty.

      If left empty, I would like the Message Dialogue Box choice 1 to be repeated endlessly.

       

      • New Record/Request
      • Go to Layout [ “Add Record” (CurrentFile) ]
      • Insert Current Date [CurrentFile::Date ] [ Select ]
      • Paste [ CurrentTable::Client ID ] [ Select ]
      • Go to Field [ CurrentFile::Image ID ] [ Select/perform ]
      • Pause/Resume Script [ Indefinitely ]
      • Commit Records/Requests [ No dialog ]
      • If [ GetAsBoolean ( CurrentFile::Image ID ) = 0 ]
      • Show Custom Dialog [ Title: "No Image ID"; Message: "The Image ID field has been left empty"; Buttons: “Try again”, “Cancel” ]
      • If [ Get ( LastMessageChoice ) = 1 ]
      • Go to Layout [ “Add Record” (CurrentTable) ]
      • Clear [ CurrentFile::Image ID ] [ Select ]
      • Go to Field [ ]
      • Go to Field [ CurrentFile::Image ID ] [ Select/perform ]
      • Pause/Resume Script [ Indefinitely ]
      • Go to Layout [ “Reports” (CurrentFile) ]
      • Open File [ “Original File” ]
      • Else If [ Get ( LastMessageChoice ) = 2 ]
      • Delete Record/Request [ No dialog ]
      • Go to Layout [ “Reports” (CurrentFile) ]
      • Open File [ “Original File” ]
      • End If
      • End If
      • Go to Layout [ “Reports” (CurrentFile) ]
      • Open File [ “Original File” ]

       

      TIA !!!

        • 1. Re: Stop script from continuing if field is left empty. Help.
          philmodjunk

          New Record/Request
          Go to Layout [ “Add Record” (CurrentFile) ]
          Insert Current Date [CurrentFile::Date ] [ Select ]
          Paste [ CurrentTable::Client ID ] [ Select ]
          Set Field [ CurrentTable::Client ID ; Get (ScriptParameter)]
          Go to Field [ CurrentFile::Image ID ] [ Select/perform ]
          Pause/Resume Script [ Indefinitely ]
          Commit Records/Requests [ No dialog ]
          Loop
                 If [ IsEmpty ( CurrentFile::Image ID ) ]
                         Show Custom Dialog [ Title: "No Image ID"; Message: "The Image ID field has been left empty"; Buttons: “Try again”, “Cancel” ]
                         If [ Get ( LastMessageChoice ) = 1 ]
                                 Go to Layout [ “Add Record” (CurrentTable) ]
                                 Clear [ CurrentFile::Image ID ] [ Select ]
                                 Go to Field [ ]
                                 Go to Field [ CurrentFile::Image ID ] [ Select/perform ]
                                 Pause/Resume Script [ Indefinitely ]
                                 Go to Layout [ “Reports” (CurrentFile) ]
                                 Open File [ “Original File” ]
                         Else If [ Get ( LastMessageChoice ) = 2 ]
                                 Delete Record/Request [ No dialog ]
                                 Go to Layout [ “Reports” (CurrentFile) ]
                                 Open File [ “Original File” ]
                                 Exit Script []
                         End If
                         Exit Loop IF [Not Isempty ( CurrentFile::Image ID) ]
                 End If
          End Loop
          Go to Layout [ “Reports” (CurrentFile) ]
          Open File [ “Original File” ]

          Note: I am also suggesting with this script that you pass the ClientID as a script parameter instead of copying it to the clipboard. This avoids annoying and confusing your user should they ever copy data to the clipboard before they run this script. It also means that CurrentTable::ClientID no longer needs to be physically present on this layout.

          • 2. Re: Stop script from continuing if field is left empty. Help.
            PaddyCakes

            Thank You PhilModJunk for taking the time to help me. The idea of using a Loop is the information that heiped the most!

            ps can one pass a parameter between two separate files?

            Thanks again!

            • 3. Re: Stop script from continuing if field is left empty. Help.
              philmodjunk

              Yes you can. Perform Script is a step that can perform a script defined in another file and the script parameter box in it can be used to pass data to that script just as though the script were defined in the same file.