Home > Domino Tips > Developer > Formula > Formula debugger
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

FORMULA

Formula debugger


Amit Bhardwaj
11.06.2004
Rating: -3.15- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


There is an undocumented function that is very handy for developers. It's a "formula debugger." To activate this formula debugger, hold down the Control and Shift keys, go into the menu and selecting File -> Tools -> Debug LotusScript. To turn it off, just repeat the same steps. You won't see a check mark or any indication of its activation in the menu, but when you go into a database and choose an action that uses formula code, a debugging window will pop up similar to the LotusScript debugger.

The top half of the panel displays your formula code with the returned values in the bottom half of the screen. You can step through your code. It's really handy and you don't have to fool around with the laborious process of inserting and removing @Prompts in your code. Of course, Lotus doesn't support this (yet).

MEMBER FEEDBACK TO THIS TIP

Yes, this is a great tip, but the author forgot to mention two very important points:

  1. This formula debugger itself is very instable, which is why Lotus does not support nor document it.
  2. This debugger is no longer available since N6. Hence, we are back to the laborious @prompt debugging.

—Jens-B. A.

******************************************

Here's a little formula I have put into a smart icon that helps me debug formula. It uses the built in function in ND6 that was created to check formula code (i.e., @CheckFormulaSyntax).

The code allows you to copy and paste the formula code into the input box and it check's whether it has been put together correctly.

formula:= @Prompt([OkCancelEdit]; 
"Formula Checker"; "Enter the Formula to be 
Checked"; "" ); Explain:= "Returns the 
text list as follows - errorMessage : 
errorLine :
errorColumn : errorOffset : errorLength : 
errorText."; @Prompt([Ok]; "Formula 
Check Result"; Explain + @Char(13) + 
@Implode(@CheckFormulaSyntax( 
Formula ) ; ","  ) )

—Graham F.

******************************************

This doesn't appear to work in Notes 6. When I hold the Ctrl-Shift keys simultaneously, and click on File-Tools-Debug LotusScript, it doesn't turn the Debugger on (i.e., there isn't a checkmark next to "Debug LotusScript" in that menu). Can you confirm whether that's for Notes 6 or just Notes 5 and earlier?

—Daniel T.

******************************************

Yeah this tip works great for R5x or earlier clients but won't work in R6x clients.

—Amit Bhardwaj, tip author

******************************************

I think this is a great tip! The writer suggested using it prior to any Evaluate() call. suggest using it to debug any @Formulas you are working with during routine development. I created a simple form that I put in my utilities database and will use it all the time. The form has one field and one action button. Put something like this in the button:

Sub Click( Source As Button )
 
 Dim ws As New NotesUIWorkspace
 Dim uiDoc As NotesUIDocument
 Set uiDoc = ws.CurrentDocument
  
 iRC = CheckSelectionFormulaValid
( uiDoc.FieldGetText("testFormula" ) )
 
 If iRC(0) = NO_ERROR Then
  Msgbox "Formula is valid!"
 Else
  Print "Formula error: " & GetAPIError(iRC(0))
  Print "Error starts at character: " & Cstr(iRC(1)) 
& " and ends at character: " & Cstr(iRC(2))
  
  Msgbox "Error starts at character: " & Cstr(iRC(1)) 
& " and ends at character: " & Cstr(iRC(2)), , _
  "Formula error: " & GetAPIError(iRC(0))
  
 End If
 
End Sub

You may also want to check out another tip, called Validating a Notes formula from LotusScript. That tip is closely related to this one.

—Doug J.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Amit Bhardwaj. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Formula
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Provide rich-text formatting via the Profile document and Formula
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Formula language button manages Deny Access list searches
Retrieve Lotus Notes names from a nested group using @DBLookup
Create a computed Lotus Notes field to list Personal Address Book names
Show multiple Lotus Notes document fields in a single view column
How to send a document as a link in a Lotus Notes email

Lotus Notes Domino Formula Language
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Do I use Formula or LotusScript to include a doclink to a Notes view?
Top 10 Lotus Notes/Domino coding and development tips of 2008
Provide rich-text formatting via the Profile document and Formula
Top 10 Formula language tips
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Stop response documents from showing in a Lotus Notes form
Formula language button manages Deny Access list searches

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts