Solved

Button formula works in R4 but hits error message in R5

Posted on 2004-08-03
11
349 Views
Last Modified: 2013-12-18
Would like to have solution for this problem. When we click on the button Confirm or button Approved Form  error messages pop-up but the document is still saved. The origional coding is from Lotus Notes 4.6 (no error message) but when run in Lotus Domino R5 the error message is appeared . Can you check what's wrong with the code?

Error messages:
1.Direct_Payment_&_DB/CR_Note:SAVE:
NotesUIDocument:SaveCancelled.  OK

2. Saving not allowed.  OK


Confirm button command
=====================
@If(@IsDocBeingEdited = 0 ; @Command([EditDocument]) ; "");
@If(DP_Name = "" ; @Return(@Prompt([OK]; "Reminder"; "Type requester name.")) ; "") ;
@If(DP_Reason = "" ; @Return(@Prompt([OK]; "Reminder"; "Type reason for request.")) ; "") ;
@If(@Text(DP_Atotal;"F,2") = @Text(DP_Atotal_1;"F,2") ; "";@Return(@Prompt([OK];"Reminder"; "Amount Not Equal" )));
@SetField("DP_CStatus";"Pending Account Approval") ;

dpsend := @If(DP_Drc_Pay = "Direct Payment" ; "Elaine Tan" ; "Chong Jin Chien");
dppost := "Accounts Department";
dpsts := dpsend + "(" + dppost + ") on " + @Text(@Now;"S2") ;

@SetField("DP_Wait" ; dpsts);
@SetField("DP_Update";"");
@SetField("DP_Log";"");
@SetField("DP_Save";"");
@If(DP_Drc_Pay = "Direct Payment" ;@SetField("dp_Role";"APICM");@SetField("dp_Role";"APICAM"));

@PostedCommand([FileSave]);
@Command([FileCloseWindow])

Approved button command
======================
psts := @Prompt([PASSWORD]; "Password"; "Enter your password .");
@If(@DbLookup("":"NOCache";"@Subset(@DbName;1)":"EPSsAddr.nsf";"Full Name";@Name([CN];@UserName);5) = @Password(psts) ;"";@Return(@Prompt
([OK];"Message";"Invalid Password! Try Again")));
@If(@IsDocBeingEdited = 0 ; @Command([EditDocument]) ; "");
@SetField("dp_update";"ok") ;
@SetField("DP_CStatus"; "Approved" )  ;

dppost := @DbLookup("":"NOCache";"@Subset(@DbName;1)":"EPSsAddr.nsf";"Full Name";@Name([CN];@UserName);3) ;
sts := "on " + @Text(@Now );

@If(DP_Chk = "" ; @SetField("DP_Chk";dppost) & @SetField("DP_Chkname";@Name([CN];@UserName)) & @SetField("DP_Chkdate";sts);
DP_Chk1 = "" ; @SetField("DP_Chk1";dppost) & @SetField("DP_Chkname1";@Name([CN];@UserName)) & @SetField("DP_Chkdate1";sts);
DP_Chk2 = "" ; @SetField("DP_Chk2";dppost) & @SetField("DP_Chkname2";@Name([CN];@UserName)) & @SetField("DP_Chkdate2";sts) ;"");

@SetField("DP_wait"; "");
@SetField("DP_Update"; "") ;
@SetField("DP_Status"; "");
@SetField("dp_save";"");
@SetField("DP_Log";"");

@MailSend(DP_ID ; "";""; DP_Form_No + " Approved by " + @Name([CN];@UserName) ; "This Direct Payment already Checked by " + @Name([CN];@UserName) ; ""
 ; "");

@PostedCommand([FileSave])

0
Comment
Question by:kamar
[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
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 11701614
I think u should be having problem with Confirm button command

make these 2 lines @PostedCommand([FileSave]);
@Command([FileCloseWindow])

to

@Command([FileSave]);
@PostedCommand([FileCloseWindow])
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11704012
Recompile (Resave) the code in R5 and give it a try..

~Hemanth
0
 

Author Comment

by:kamar
ID: 11711892
We tried the code changes as suggested
@Command([FileSave]);
@PostedCommand([FileCloseWindow])
but the same error still popped up R5.  Is there anymore suggestions that I can try. Thank you.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kamar
ID: 11711965
If we compile the code using R5 Designer, would it create error on R4 clients?
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 11712266
I think it should not give error.
Since the same code is supported in R4 also. resave the form in R5 and try to access.

Give it a try and let us know.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 11712307
or check whether there is any LS code in QuerySave.
0
 

Author Comment

by:kamar
ID: 11712381
I have this LS code in QuerySave.  Is there anything not supported in R5?

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Set ws = New NotesSession    
      Set db = ws.CurrentDatabase
      Set view = db.GetView("Direct_Seq No")
      
      Dim dpyear,dpmonth,dpnum,dpday As Variant
      Dim num As String
      Dim curnum As Integer
      Dim dpdesc As Variant
      Dim scurnum As String
      Dim p_sts As Variant
      Dim bsaved As Integer
      Dim SeqNo As Long    
      
      Dim nwyear,nwmonth,nwday,status  As Integer              
      
      Dim curdoc As NotesDocument              
      Set curdoc = source.Document
      
      If curdoc.dp_save(0) = "Save" Then
            Msgbox "Saving not allowed"          
            continue = False
      Else
            
            If curdoc.DP_Form_No(0) = "" Then
                  
                  bsaved = False
                  
                  While (bsaved = False)
                        
                        Set doc = view.GetFirstDocument              
                        dpyear = doc.GetItemValue("Seq_Year")  
                        dpmonth = doc.GetItemValue("Seq_Month")
                        dpnum = doc.GetItemValue("Seq_No")
                        dpdesc = doc.GetItemValue("Seq_Desc")
                        
                        nwyear = Cint(dpyear(0))
                        nwmonth = Cint(dpmonth(0))
                        
                    'If nwyear <> Year(Today) Then
                     '    nwyear = Year(Today)
                      '   nwmonth = Month(Today)
                       '  curnum = 1
                    'Elseif nwmonth <> Month(Today) Then
                     '    nwyear = Year(Today)
                      '   nwmonth = Month(Today)
                       '  curnum = 1
                    'Else
                        curnum = Cint(dpnum(0))  + 1
               'End If
                        
                        scurnum = Cstr(curnum)
                        
                        If Len(scurnum) = 1 Then
                              scurnum = "000" & scurnum
                        Elseif Len(scurnum) = 2 Then          
                              scurnum = "00" & scurnum
                        Elseif Len(scurnum) = 3 Then
                              scurnum = "0" & scurnum
                        End If
                        
                        If Len(nwmonth) = 1 Then
                              nwmonth = "0" & nwmonth
                        Else
                              nwmonth = nwmonth
                        End If
                        
                        num = "DP" + Cstr(nwyear) + Cstr(nwmonth) + scurnum
                        
                        Call curdoc.ReplaceItemValue("DP_Form_No", num )
                        
                        Call doc.ReplaceItemValue("Seq_No",curnum)
'                    Call doc.ReplaceItemValue("Seq_Year",nwyear)
'                    Call doc.ReplaceItemValue("Seq_Month",nwmonth)
                        If doc.Save(False,False)   Then
                              bsaved = True
                        Else
                              Set doc = Nothing
                              bsaved = False
                        End If
                  Wend                  
            End If          
            curdoc.dp_save = "Save"
      End If          
End Sub
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 125 total points
ID: 11712517
if u debug this code from a R5 PC, u can capture the error where it comes.

and where are the declarations for all the variables? db,ws, etc.,... In Global?

'I suspect the error comes from here:
If doc.Save(False,False)   Then
                         bsaved = True
                    Else
                         Set doc = Nothing
                         bsaved = False
                    End If
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11714906
R5 supports R4+ R5 new enhancements.. So it is not that it is back level code...

Could be the error msg is genuinely raised by one of your script functions and not of any corruption !!
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11720494
The second message comes from your QuerySave:

  If curdoc.dp_save(0) = "Save" Then
          Msgbox "Saving not allowed"          
          continue = False
     Else

The first message may also come from the same due to continue-false, though I would think it shoudln't do that, and certainly shoudl not do that until after the second message displays.
 
0
 

Author Comment

by:kamar
ID: 11723082
Thank you guys. We resolved this after declaring the variables in the QuerySave script. Appreciate all the help given. Thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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