• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Button formula works in R4 but hits error message in R5

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
kamar
Asked:
kamar
  • 4
  • 4
  • 2
  • +1
1 Solution
 
madheeswarCommented:
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
 
HemanthaKumarCommented:
Recompile (Resave) the code in R5 and give it a try..

~Hemanth
0
 
kamarAuthor Commented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
kamarAuthor Commented:
If we compile the code using R5 Designer, would it create error on R4 clients?
0
 
madheeswarCommented:
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
 
madheeswarCommented:
or check whether there is any LS code in QuerySave.
0
 
kamarAuthor Commented:
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
 
madheeswarCommented:
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
 
HemanthaKumarCommented:
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
 
qwaleteeCommented:
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
 
kamarAuthor Commented:
Thank you guys. We resolved this after declaring the variables in the QuerySave script. Appreciate all the help given. Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now