Solved

Emulate @Return in Script

Posted on 2004-08-17
3
221 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

630 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