Accessing layouts


Dependant on where report layouts are saved, the commands to access these layouts differ.


Difference in the commands


Parameters

If the layouts are saved on the file system, then the passing of the report name is usually sufficient, whereby if the reports are stored in a database, then server and database names have to be passed.


Name

Both "groups of commands" start with the same command name. The commands accessing report layouts in databases show the extension "FromDatabase" (e.g. NTPInitFromDatabase). This allows for the commands to be easily recognized.


How the commands "work"

The commands accessing reports stored on the file system, create a temporary copy of the report files in the configured temp. directory.
The commands using layouts stored in databases, temporarily store copies of these files under temporary file names in the temp. directory of that computer.
The files thus created are used to access the report layout and the creation of the report. After closing the report, these files are then removed.


The following excerpt of a script (not complete, so not executable) shows the usage of report layouts saved in databases:

REM Read the environment  
Set session =New NotesSession  
Set db = session.CurrentDatabase  
Set collection = db.UnprocessedDocuments  

REM Read the settings of the current database  
DatabaseName = db.FilePath  
ServerName = db.Server  

REM Initialize the buffer for the report name  
StrBuffer = Space(254)  

REM Display the report list ( the report name is returned in "StrBuffer" )  
If NTPReportListFromDatabase ( StrBuffer, ServerName, DatabaseName ) >= 0 Then  

StrBuffer = Trim ( StrBuffer )  
REM Determine the number of fields in the report  
FieldCount = NTPGetFieldCountFromDatabase ( StrBuffer, ServerName, DatabaseName )  

If ( FieldCount >= 0 ) Then  
REM Read all field names from the report and store them in a list  
For Counter = 1 To FieldCount  
FieldBuffer = Space(254)  
Status = NTPGetFieldNameFromDatabase ( StrBuffer, ServerName, DatabaseName, Counter, FieldBuffer )  
FieldBuffer = Trim ( FieldBuffer )  
FieldList( Counter ) = FieldBuffer  
Next Counter  

REM Initialize a new report  
ReportID = 0  
ReportID = NTPInitFromDatabase ( StrBuffer, ServerName, DatabaseName, 0)  

If ReportID >= 0 Then  
.........