cschmitz Posted May 9, 2008 Share Posted May 9, 2008 I have a script for creating shipping forms. Currently The script says goto related record in the shipping forms database and create a new record. This works if there are already shipping forms created for the repair record, but if there is not the script returns a record not found error. I put an if statement after the goto related record step that says if( Get(LastError) = 101) Open new window, goto layout, create new record. The problem is the if statement will not recognize the 101 error and skips the step. I verified that the Get(LastError) sees the 101 by showing a custom dialog box that just has Get(LastError) displaying. It does show the 101 but the if statement directly after it will not recognize the error. Any ideas of where I'm going wrong on this one? Link to comment Share on other sites More sharing options...
Ender Posted May 9, 2008 Share Posted May 9, 2008 For capturing errors, the placement of the error check must be immediately after the step your trapping for. Even a comment line can cause it to be missed. I'd recommend changing your code to check for the presence of a related record prior to the GTRR: If[not isempty(relationship::recordID)] #Related record exists Go to Related Records[] Else #No related records Perform Script[Add related record] End If Link to comment Share on other sites More sharing options...
cschmitz Posted May 9, 2008 Author Share Posted May 9, 2008 Understood. Thanks for the advice. That structure looks a bit cleaner than what I was trying to build. I'll give it a try. That's good to know about the error check. I hadn't run into that in any of my other scripts yet, but that will save me a lot of possible headache in the future. Link to comment Share on other sites More sharing options...
Recommended Posts