Solved

problem with schedule agnet and storing values in files

Posted on 2002-03-11
8
223 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 8

Accepted Solution

by:
Jean Marie Geeraerts earned 100 total points
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 8

Expert Comment

by:Jean Marie Geeraerts
Comment Utility
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
Comment Utility


Thank u very much.

saleem.
   
0
 
LVL 8

Expert Comment

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

Author Comment

by:saleemkhan
Comment Utility
hai jerrith,
    i am sick.so thats why i am late.



sorry for delay.

saleem khan.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now