Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

problem with schedule agnet and storing values in files

Posted on 2002-03-11
8
233 Views
Last Modified: 2013-12-18
hai experts,
   
      i created schedule agent schedule hourly and storing the values in agent using environmnet variables like

  Call session.SetEnvironmentVar("SES_var",varname)    
 
  and to display the output in agent i am using

sessionvar=session.GetEnvironmentString("SES_var")

Its working fine.
   But the main problem is when the schedule agent is running
   when i try to access the session variables it will display the session variable until and unless the  schedule agent is run successfully(completed) .
          so to avoid the delay which is the best solution.Waiting for experts solution and experts hint.

     i thought of storing all the session  variables in files and every hour the file should be updated.

    i dont know how to store all the session variables in files and update the session variables values and depending on the users roles i want to display the output from the files
         or is there anyway to achieve this task.


if there is any solution better than this suggest me.

saleem.
0
Comment
Question by:saleemkhan
  • 4
  • 2
  • 2
8 Comments
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6856158
Did you try profile documents instead of environment variables ?

Or a separate set of documents instead of files that can be updated everytime the agent runs?

This method is more efficient since you have a separate document for each time the agent running and you could take reports right from the view itself.

:-)
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 6856160
Even in this cases, the document have to be saved first before you could get its values for someother processing.

If you can let us know the exact purpose on why you need the values while the agent is running we could give you better alternatives.

:-)
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6857566
I was thinking along the same lines.
Keep the values for variables in a profile or regular document and save this document at the end of the agent.

At the start of the agent, perform a lookup of the document and assign the new values to the document when you find one, or create a new document if no document exists.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 8

Accepted Solution

by:
Jean Marie Geeraerts earned 100 total points
ID: 6859934
I've sent you a little sample db by email.
Here's what's in the database :

1) A Start page with a button to run the agent and show a view that holds the document with the stored variables
2) A hidden form, called "(Variables)|VARS" to store the variables.
3) A hidden view, called "(LookupVariables)", used in the agent to lookup the document.
4) An agent to open/create the document and store the used variables.

I'll explain the above in detail:

The Start Page
----------------------------------------------------------
Name : Start
Contains a button with the formula :
   @Command([ToolsRunMacro]; "Store variables")
Contains an embedded view element, showing the view that holds the variables document.

I set the launch options of the database to open this page when the database is opened from web. (I remember, you write most things for web use)

The Form to store the variables
----------------------------------------------------------
Name : (Variables)|VARS
Contains a field for every variable we want to store:
A few examples:
LastRun : Date/Time field
Start : a Number field
LastUser : a Names field
SampleText : a Text field

I have also included a button on the form to return to the opening page of the database:
Formula : @Command([OpenPage]; "Start");

The view to lookup and show the variable document
----------------------------------------------------------
The view is set to display only the variable documents by using a view formula to use only documents created with above form.

I've created a column for each variable in the view, where the LastRun column is the first column and I've set this column to be sorted in descending order. So the most recent document is first. (In case you decide to always create a new document and not update the existing one, you need to have a sorting order to look up the correct document)

The agent
----------------------------------------------------------
Name: Store variables
Run : Manually from Agent List
On : Run Once (@Commands may be used)
Agent properties : Run agent as Web user

Here's the script I used to open the document if it exists or create a new one if it doesnt.
This little sample code, gets the document and then adds the current date to the LastRun field, adds 1 to the Start field, adds the current user's name to the LastUser field and sets some sample text in the SampleText field.
After the agent finishes, it reopens the database to refresh the view on the start page.

Sub Initialize
      REM ==============================================================================
      REM Initialize session variables
      REM ==============================================================================
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Set db=session.CurrentDatabase
      Dim doc As NotesDocument
      Dim LookupView As NotesView
      
      REM ==============================================================================
      REM Define variables to store in the form
      REM ==============================================================================
      Dim LastRun As New NotesDateTime(Now)
      Dim Start As Long
      Dim LastUser As NotesName
      Dim SampleText As String
      
      REM ==============================================================================
      REM Get Variable document
      REM ==============================================================================
      Set LookupView=db.GetView("(LookupVariables)")
      Set doc=LookupView.GetFirstDocument
      If doc Is Nothing Then
            Set doc=db.CreateDocument
            doc.Start=0
      End If
      doc.Form="VARS"
      doc.LastRun=LastRun.DateOnly
      doc.Start=doc.Start(0)+1
      Set LastUser=New NotesName(session.EffectiveUsername)
      doc.LastUser=LastUser.Abbreviated
      doc.SampleText="This is just some sample text"
      Call doc.Save(True,False)
      
      REM ==============================================================================
      REM open the root page of the database
      REM ==============================================================================
      Print "[/" + db.FilePath + "]"
End Sub
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6859941
To show the runtime including time you could use the following line:

doc.LastRun=LastRun.LocalTime

This will return a value like "13/02/2002 09:46 CET"
0
 

Author Comment

by:saleemkhan
ID: 6882669


Thank u very much.

saleem.
   
0
 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
ID: 6884814
You're welcome. How have you been? Long time no see...
0
 

Author Comment

by:saleemkhan
ID: 6885152
hai jerrith,
    i am sick.so thats why i am late.



sorry for delay.

saleem khan.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question