Monthly Archives: January 2022

Create a random letter in Excel

I know that this is quite simple in Lotusscript, but some days I needed to create some kind of random string for a excel import and I thought let’s share this someone else might need this too or I might need this in the future and then I have it stored in my secondary archive my blogg 😉

=IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(65;90));IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(49;57));IF(RANDBETWEEN(1;9)>RANDBETWEEN(1;9);CHAR(RANDBETWEEN(97;122));CHAR(RANDBETWEEN(35;49)))))

This will create a random character , if you need a 8 letter string copy and paste this string with a and sign & between the formula eight times. I use this for simple password creation, Import keys.

Another of my excel functions I use alot is XLookup to get values from other sheets great to use when you have data from multiple sources. Checkout how to use it here

Hope this will help you, if you have some great Excel formulas post them in the comments.

Disable the first run off Lotusscript And Java agents after save

If you ever created some Notes/Domino agents and seen that everytime you save them a first run is scheduled outside or ordinary schedule. This can easily be avoided. Just add this code to the top of your agent

Dim s As New NotesSession
Dim a As notesagent
Set a=s.Currentagent
If a.Hasrunsincemodified=False Then Exit sub

This will make the agent to skip it’s first run, easy way stop the Lotusscript agent of running at odd hours and perhaps sending extra emails that confuses your users. You can ofcourse implement the same functionality in an Java agent.

If you want to run the same code inside a java agent then the code looks like this

try {
          Session session = getSession();
          AgentContext agentContext = session.getAgentContext();
         if(agentContext.getCurrentAgent().getLastRun()==null){
        	 System.out.println("Not runned before");
         }else{
        	 System.out.println("Has runned");
         }

          // (Your code goes here)

      } catch(Exception e) {
          e.printStackTrace();
       }