Solved

Emulate @Return in Script

Posted on 2004-08-17
3
218 Views
Last Modified: 2013-12-18
HI Guys

I would like to know how to emulate @Return in script or how to stop a script from continuing if a condition is not met

I have tried Continue = false and Exit Sub

Is there another way as Continue = False does not seem to work and Exit Sub sometimes is a little drastic

If uidoc.FieldGetText("CreateSrce") = "Ext" And uidoc.FieldGetText("genrlcomnt") = "" Then
            Msgbox "Warning .... You must enter a comment or complete the form prior to submitting to an approver", 0+16+0+0, "Missing Information"
            Valid = False
            continue=False
0
Comment
Question by:imjamesw
3 Comments
 
LVL 24

Assisted Solution

by:HemanthaKumar
HemanthaKumar earned 100 total points
ID: 11821697
Continue is available only in the notes events !

You can do lots of things with LS.. tell me what you really want to do.

eg:

If I want to see if the current doc is a new doc and do certain things but not for already saved doc.. I woul incorporate a if statement and deal with it

if uidoc.IsNewDoc then
' do this
else
' do nothing
End if

~Hemanth
0
 
LVL 15

Assisted Solution

by:Bozzie4
Bozzie4 earned 200 total points
ID: 11821702
exit sub or exit function will do just fine.

End is also an option

continue=false only works in the events that support this (like the QuerySave event)

cheers,

Tom
0
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 200 total points
ID: 11822073
While coding in LS, do check your function/proc headers. 'Continue' is a parameter in some 'Form Events' for instance 'QuerySave' and 'Queryclose'. Examine the function header. THese are:

Sub Querysave(Source As Notesuidocument, Continue As Variant)
Sub Queryclose(Source As Notesuidocument, Continue As Variant)

You can see that they are parameters to the function (Event). In these two cases the significance of this parameter is that, you can set them to 'False' to indicate that you want the 'Event' to FAIL. (somehting like you do with @Failure).

Make no mistake. Continue is NOT a global identifier/helper object that indicates a failure condition.

That was a general explanation. To continue with how you achieve what you wanna achive. Simple, implement it yourself. Generally I write a Validate routine at the form level to do so. In the form's 'Globals' section, create a function with this prototype.


function Validate() as variant


Now put your code there. Your complete function may look something like this:


Function Validate() As Variant
      Validate = True
      
      If uidoc.FieldGetText("CreateSrce") = "Ext" And uidoc.FieldGetText("genrlcomnt") = "" Then
            Msgbox "Warning .... You must enter a comment or complete the form prior to submitting to an approver", 0+16+0+0, "Missing Information"
            Validate = False
            Call uidoc.GotoField("CreateSrce")
      End If
End Function



Now, to use this function write this one liner in your Form's QuerySave/QueryClose...


Continue = Validate()





0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question