Solved

Button formula works in R4 but hits error message in R5

Posted on 2004-08-03
11
341 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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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