Domino Code Fragment

Code Name*
Using environment variables
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.117.142.128
Description*
1. This example increments the environment variable $SeqNo by one and prints the result. (This script would not be reliable on a server for maintaining a system of sequential numbers.)
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


class seqno extends NotesThread
{
 public static void main(String argv[])
   {
       seqno t = new seqno();
       t.start();
   }


 public void runNotes()
   {
   try
     {
       Session s = Session.newInstance();
       int seq;
       if (s.getEnvironmentValue("SeqNo") == null)
         seq = 0;
       else
         seq = ((Integer)s.getEnvironmentValue("SeqNo")).intValue();
       System.out.println(seq);
       seq++;
       s.setEnvironmentVar("SeqNo", new Integer(seq));
       System.out.println(s.getEnvironmentValue("SeqNo"));
     }                
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}