0 Replies Latest reply on Sep 10, 2012 7:01 AM by Slinky66

    Correct Way to Use Try Blocks

    Slinky66

      Title

      Correct Way to Use Try Blocks

      Post

      I am debugging an issue that sometimes causes -1728 errors on a client machine. I have located a point in the script
      where a variable "theInventoryID" is being set without any type of checking:
      
      set theDatabaseName to "F&B POs"
      set theCellName to "Product ID"
      tell application "FileMaker Pro"
      
        set theInventoryID to contents of cell "ID" of current record
        tell database theDatabaseName
        --  -1728 error happens here!!
      
        show layout "Inventory - All Quantities"
        show every recordIs this the correct way to mitigate those -1728 errors?
      
      
      tell application "FileMaker Pro"
       try
        set theInventoryID to contents of cell "ID" of current record
        on error
          display dialog ("Make sure all inventory ids are valid")
       end try
      
      tell database theDatabaseName
      --  -1728 error happens here