Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



Programmatic control of the current server, database and view name

Lotus Notes developers are used to having programmatic access to the name of the current server, current database name, current view etc. and using these in their development work.

However Integra for Notes is designed as an independent database from the database from which data is being exported or imported and therefore when an Integra profile is being run, the use of the standard techniques to obtain the current server, current database name, current view etc. such as the @DbName function for the current server and database will in fact return the value of the Integra database.

What the developer usually requires is the current server and current database name of the database from which the data is being exported. We refer to this as the source database for an export and a target database for an import process.

In the case of a profile creator utilising the Lotus Script Callback in the Advanced tab this is no problem whatsoever, as a developer can refer back to the source database using the Integra runtime objects as documented in the user manual. However, the use of formulae encounters this problem. But even here exist a very simple solution.

When a user is positioned in the source database and clicks on the Integra SmartIcon, exactly before moving focus to the Integra database, the code behind the SmartIcon stores the details of the current server, database, view etc into temporary environment variables stored in the user's Notes.ini. A developer is then able to refer back to these environment variables. The environment variables are names as follows:
  • IntegraCurrentSrv - stores the name of the server of the database the user has currently open on his desktop
  • IntegraCurrentDB - stores the pathname and filename of the database the user has currently open on his desktop
  • IntegraUiView - stores the view's alias name the user has currently open on his desktop
  • IntegraUiDocID - stores the document's unique id the user has currently open on his desktop

So having a field formula you can add the following code:

srv := @environment("IntegraCurrentSrv");
db := @environment("IntegraCurrentDB");
res := @dblookup("":"";srv:db;"YourViewName";"YourLookupKeyword";ReturnValueColumnNumber);
@if(@iserror(res);"";res)

If you need to refer back to field values within the currently active document opened on screen, you can do this using the Advanced tab. In the Formula Callback tab you can add code to set environment variables which can then be read in the formulas created for a Formula field:

statlist := "CB_BFORWRITECOM":"CB_BFORNOTESACTION":"CB_INITIALISE":
    "CB_TERMINATE":"CB_BFORCOMACTION":"CB_BFORREADNOTES";
envstat := @texttonumber(@environment("FormulaCbStatus"));
status := @subset(@subset(statlist;envstat);-1);

@if(
    status="CB_INITIALISE";
      "";
    status="CB_BFORREADNOTES";
      @SetEnvironment("MyLookupKeyword";MyLookupKeywordFieldName);
    status="CB_BFORWRITECOM";
      "";
    status="CB_BFORCOMACTION";
      "";
    status="CB_BFORNOTESACTION";
      "";
    status="CB_TERMINATE";
      "";
    ""
)

The formula to your Formula field would then look like this:

srv := @environment("IntegraCurrentSrv");
db := @environment("IntegraCurrentDB");
key := @environment("MyLookupKeyword");
res := @dblookup("":"";srv:db;"YourViewName";key;ReturnValueColumnNumber);
@if(@iserror(res);"";res)

.




FAQ# 0108
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024