Home > Ask the Domino Experts > Domino Designer Questions & Answers > Call 'Recompile all LotusScript' option from LS or Java
Ask The Domino Expert: Questions & Answers
EMAIL THIS

Call 'Recompile all LotusScript' option from LS or Java

Brad Balassaitis EXPERT RESPONSE FROM: Brad Balassaitis

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site


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


>
QUESTION POSED ON: 01 December 2004

View member feedback to this Ask the Expert Q&A.

Is there a way to programmatically call the "Recompile all LotusScript" option from LotusScript or Java? We are in the process of upgrading all of our applications to R6 and want to recompile the LotusScript on each database to validate the codes inside each design element. It would save us a lot of time if we can loop through all the databases on the server and call on this option to recompile all of the LotusScript.


>
There isn't a way to recompiled all LotusScript from LotusScript or Java. However, if you're really ambitious, it is possible to write code that uses the C API to compile LotusScript. The C API toolkit can be downloaded for free from the IBM Lotus Web site.

There isn't a single command to compile an entire database, so you would need to write code to loop through all forms, script libraries, agents, etc,. and compile them one-by-one. It can be tough to write this kind of code, but it should perform well, since API code runs at the operating system level and is very fast.

Below is the description of the NSFNoteLSCompile function from the API reference.

NSFNoteLSCompile - Compile a note containing LotusScript modules.

-------------------------------------------------------------------------

#include <nsfnote.h>

STATUS LNPUBLIC NSFNoteLSCompile(
DBHANDLE hDb,
NOTEHANDLE hNote,
DWORD dwFlags);

Description :

The API compiles all the LotusScript 
code found in a design document. This 
includes document classes such as 
Views, Agents, Forms, Pages, Navigators, 
Shared fields, script libraries, Help
 documents, using database documents, 
etc. It is a way of making sure that the 
object code of the script is up-to-
date. 
For the Agent note, the compiled object 
code is saved in the $AssistAction_Ex 
item.
Parameters :
Input :
hDb - Handle to the database.
hNote - Handle to the note containing 
LotusScript modules.
dwFlags - (Reserved for future use) Must be 0.

Output :
(routine) - (routine) - Return indicates 
either success or what the error is. 
The return codes include: 
NOERROR - Operation was successful.
ERR_NULL_NOTEHANDLE - if hNote was 
not specified.
ERR_xxx - STATUS returned from a lower 
level Notes function call.

Sample Usage :
...
/* Compile the Agent note */ 
if (error=NSFNoteLSCompile(hDb,hAgent,0))
{
printf("Error: LS Compilen");
goto Exit1;
}

/* Update the note */
if (error=NSFNoteUpdate(hAgent,0))
{
printf("Error: can't update note after LS Compilen");
goto Exit1;
}

MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A:

The exception I have to the answer for this question is that Brad was all too happy to answer the technical question without addressing the reason for the question being asked.

Compiling actually changes code, unlike signing, and if your company has rules about changing code on a production system without going through development phases, that should give you some direction. Besides, if a problem occurs with recompiling a production database, you now have a production system with a problem! If this were able to be done programmatically, you could have a huge mess on your hands the next morning.

I have seen Domino Designer save LotusScript without raising an eyebrow, and then have the "Compile" feature throw an error. I have run the "Compile" feature and gotten errors on databases that have otherwise been working fine for years. I have had the "Compile" feature completely lock up my Designer client if there are too many circular dependencies in script libraries -- in code that ran fine in production! Compiles are not something to be taken lightly and are tools for developers -- not a maintenance task like Compile, Fixup, or Updall.

—Kieras David J.

Do you have comments on this Ask the Expert question and response? Let us know.


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



RELATED CONTENT
Domino Designer
Resolve Notes 8 migration error: 'Database has not been opened yet'
Lotus Notes access error: 'database is not opened yet'
Stop response documents from showing in a Lotus Notes form
Set a value in a field existing in another Lotus Notes database
Create an automatic scheduled view export in Excel
Display Lotus Notes fields as separate entries in one column
Creating custom Lotus Notes Domino login forms
Using LotusScript to retrieve names of fields on a Lotus Notes form
Importing data from Microsoft Excel to a Lotus Notes form
Error creating product object

LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management

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



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Lotus Notes Domino on Blackberry and mobile devices
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