Formula debugger

There is an undocumented function that is very handy for developers. It's a "formula debugger."

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.

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close