Solved

Emulate @Return in Script

Posted on 2004-08-17
3
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…

710 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