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
Solved

Formula Loop

Posted on 2004-03-29
19
356 Views
Last Modified: 2013-12-18
In the postopen event of a form, I have a dialogbox pop up to fill in a field. Now, what I want is, for that box to keep popping up until the field is filled in just in case someone might just click on the x and close the dialog box window.  How do I do it?
0
Comment
Question by:schmad01
  • 8
  • 7
  • 2
  • +1
19 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10708266
Here is a example

     Dim db As NotesDatabase
     Dim s As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim view As NotesView
     Dim doc As NotesDocument
     Set db = s.CurrentDatabase
     Set doc = db.CreateDocument
callDialog:
' Call the dialog box with doc as paremeter
Call workspace.DialogBox _
        ("Dialog Box", True, True, False, False, False,  _
     False, "Dialog Box", doc)

if doc.FieldRequired(0) = "" then goto callDialog

~Hemanth
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10708276
Can't really do it directly in R5.  R6 has @formula looping mechanisms.

What you can do is set a flag field that indicates when the formula has reached completion, put @If(flag_set; @Return(COMPLETE); @PostedCommand([ViewRefreshFields])) at the top, and put a copy of the formula in PostRecalc, if it isn't already occupied.  That will cause the formula to exit immediately if it ever completed, but otherwise, force a recalc before it even starts.  Effectively, the formula keeps looping, because the reccalc does the same thing, forcing itself to run again immediately after it completes.
0
 

Author Comment

by:schmad01
ID: 10708333
Heman,
Please clarify, let's say the field name is field1. Where do I plug that in?
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10708424
That will be in the if condition

if doc.Field1(0) = "" then goto callDialog
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10711360
You'll need to use the 'source' uidocument, instead of creating a new document.
Put this in the postopen event :

Dim db As NotesDatabase
     Dim s As New NotesSession
     Dim view As NotesView
     dim returnValue as integer
    if source.isNewDoc then
Do While source.document.Field1(0) = "" 
returnValue = workspace.DialogBox _
        ("Dialog Box", True, True, False, False, False,  _
     False, "Dialog Box", doc)
if not returnValue then
' stop it here
' close the document if cancelled
source.document.saveoptions = "0" 'you may need to add a text field, saveoptions, editable, value "1", to the form
call source.close()
end if
end if
Loop


Here, the user can cancel too, and the document will close ...

cheers,

Tom
0
 

Author Comment

by:schmad01
ID: 10713355
Variant does not contain an object
0
 

Author Comment

by:schmad01
ID: 10713465
Sorry guys, getting problems or errors on both scripts as follows.

Heman's: The loop never stops. Dialog box won't go away, even when filled in.


Bozz : Unexpected Endif Expected Loop.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10713556
Are you using correct field name ??? If not it always says that if condition is true and keeps looping .. check the spelling too
0
 

Author Comment

by:schmad01
ID: 10713971
Heman repost the correct code with these plugged in so I will know if I did it right.
The name of the field is proj num.  The name of the form with the layout region is projnum.

Thanks.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10713979
Dim db As NotesDatabase
     Dim s As New NotesSession
     Dim view As NotesView
     dim returnValue as integer
    if source.isNewDoc then
Do While source.document.Field1(0) = "" 
returnValue = workspace.DialogBox _
        ("Dialog Box", True, True, False, False, False,  _
     False, "Dialog Box", doc)
if not returnValue then
' stop it here
' close the document if cancelled
source.document.saveoptions = "0" 'you may need to add a text field, saveoptions, editable, value "1", to the form
call source.close()
end if

Loop

end if
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 125 total points
ID: 10714227
The field name cannot contain space like Proj Num... Is it ProjNum ??

If so..

     Dim db As NotesDatabase
     Dim s As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim view As NotesView
     Dim doc As NotesDocument
     Set db = s.CurrentDatabase
     Set doc = db.CreateDocument
callDialog:
' Call the dialog box with doc as paremeter
Call workspace.DialogBox _
        ("Dialog Box", True, True, False, False, False,  _
     False, "Dialog Box", doc)

if doc.ProjNum(0) = "" then goto callDialog


0
 

Author Comment

by:schmad01
ID: 10716428
Correct, the field name is actually proj_num.

Still getting error though.  Variant does not contain an object.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10716587
switch on debugger and see which line is giving that error.
0
 

Author Comment

by:schmad01
ID: 10724214
I think it is this one.  if doc.ProjNum(0) = "" then goto callDialog

The dialog box pops up, I enter my value and then I can't get it to disappear.  I have to end task to close notes and then reboot.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10724554
Can you post your code here..Also did you replace the field name properly ??
0
 

Author Comment

by:schmad01
ID: 10725003
Yep, I think I did. Here is the code:

Dim db As NotesDatabase
      Dim s As New NotesSession
      Dim workspace As New NotesUIWorkspace
      Dim view As NotesView
      Dim doc As NotesDocument
      Set db = s.CurrentDatabase
      Set doc = db.CreateDocument
callDialog:
' Call the dialog box with doc as paremeter
      Call workspace.DialogBox _
      ("projnum", True, True, False, False, False,  _
      False, "Assign Project Number", doc)
      
      If doc.proj_num(0) = "" Then Goto callDialog
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10726275
Can u send me the sample databas that has this forms and script ??
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10728179
Uh oh, EE violation.
0
 

Author Comment

by:schmad01
ID: 10759886
OK.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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