LS var not declared opening app w/o existing launch event code

  • I have an app developed in R6.5. When I migrated a bunch of its code from a parallel development effort and merged it with my XPages work yesterday, it built (and continues to build) without issue. However it does not function without issue.

  • Each time I open the application I see a dialog: “Variable not declared: PL”. Problem is the variable PL does not appear in any database script nor any code that should be running on application launch. There is no custom launch code in this system, nor has there ever been.

  • PL is my form-global audit logging instance. It’s instantiated when select documents in the system are opened by the user, for read or edit, and it tracks everything that happens to that document. It’s perfectly right and proper that it would not exist at application launch because so far that instance of Notes has never attempted to open a document.

  • Naturally debugging LS gives no clue what’s happening, because there should be no LS that runs at launch. Still I had to try, because PL is a LotusScript class object. It can not possibly even be referenced, to pop an undeclared error, unless some LotusScript code is running somewhere, rightly or not.

  • How do I even go about troubleshooting this?

Thanks for your time…

EDIT:

  • It looks like any View that contains two of the select document types causes this dialog to appear. It appears on app load because a View containing one of the “offending” document types is the default on load. If I move around the various Views, ones that do not contain either of the two document types, but that may still instantiate pl, do not pop the undeclared dialog.

Subject: Re: LS var not declared opening app w/o existing launch event code…

I had this happen when…

  1. The database launches a frameset

  2. The frameset contains a view that has docs whose forms reference a script library

  3. The frameset also contains a NotesPreview frame, and the frame with the View has this set as it’s default target

The OnOpen of the first document in the view is getting executed when the document is opened in the preview pane. The LotusScript debugger doesn’t catch it.

Subject: Thanks Charles, this is close!

  1. The database does in fact launch a frameset, but only in Notes. Since I’m web-enabling it, it launches an XPage on the web.

  2. The frameset does contain a view that has docs whose form(s) reference numerous script libraries - this would be every Form I’ve written in nearly ten years - OO and all that.

  • But I have no preview pane. The reason I know it’s close is when I open the appropriate frame in DDE it also pops the variable undeclared dialog. Now there’s weirdness!

  • Regardless, it points to something wonky with the frameset, such that even when opening that frameset in DDE, it still runs some LS code. Not quite sure how to tackle that, but it’s a definite step forward.

  • I’m still more than a little curious why <=R7 never exhibited this behaviour, where R8.5+ does, even in DDE. I’m inclined to think it’s a bug, mainly because DDE is for editing code, not running it. How could a frameset ever run code in the editor?

  • Anyone from Lotus have thoughts on this?

Thanks for your time…

Subject: DDE does execute code…

… that’s how it tells you about design elements with errors. A nifty feature but a little, um… incomplete. :slight_smile:

What’s puzzling to me is that it is running code in an OnOpen event of a document. It shouldn’t be loading the view in a runtime mode, so it shouldn’t be running the form events. But it apparently is.

Subject: It seems odd that DDE would execute my code, though…

  • I could see where it might run the compiler, or the syntax checker, but I don’t see why it would ever actually run my code in DDE. DDE doesn’t tell me where logic errors are, nor would I expect it to, but that’s the only thing running my code could possibly tell me … where logic errors are.

  • Quite frankly I wish I could tell it not to run anything on open. I get tired of waiting for it to continually rebuild code that hasn’t changed since DDE was last launched. But that’s neither here nor there.

  • I still don’t see why DDE would ever run my code for any reason, unless explicitly previewed…