Solved

Button formula works in R4 but hits error message in R5

Posted on 2004-08-03
11
347 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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