Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Emulate @Return in Script

Posted on 2004-08-17
3
Medium Priority
?
226 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 400 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 800 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 800 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview

877 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