Solved

Emulate @Return in Script

Posted on 2004-08-17
3
214 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now