Refresh computed field on form via scheduled agent ?

Hi all... first post here. I've been looking for an answer in the archives and can't find one so I'll post a new (old) question / problem.

I have a form which contains Employee information such as name, phone extension, facility they work at, etc...

On the form a have a computed field which fetches the most recent info from our HR system data... when people change departments, locations etc. ... I need this database to be refreshed daily. I know I can do it very easily with a MANUAL agent ie @Command([ToolsRefreshAllDocs]) which works great.... I just can't believe that I can't refresh a computed field via a scheduled agent.

Here's the computed field code... Uses the employee number as a key field for lookups to fetch other data:

Generally server based Agents cannot do a refresh as this requires the Notes Client UI to perform all of the database fetching and command interpretation etc.

That said the server agent can go to a lwoer level, have more flexibility and is relatively easy for what you want to do here.

You can create a scheduled agent in your database that is run daily, runs against all documents in database, has document selectiuon formulae limiting it to the particular Form name.
In the actions you can copy your formulae as above and it will then run against each of the documents in the database.

If you want to go further then look at lotusscript to manipulate the data further.

Only suggestion is that this agent should run on the server that has the empdata2.nsf database and not try to connect across the network.

There are 3 scenarios where the compute with form will not update computed fields that I can think of off the top of my head. The first is where the form is stored in document and therefor has no form associated with it, the second would be with version 8.52 where Lotus has listed that in it's bug fix docments
From the IBM Site.

When using a scheduled LotusScript agent with
"ComputeWithForm" method to recalculate
computed fields it will not work with the 8.5.2
version. The problem is also with the Lotus
Notes Client 8.5.2, if you start the agent manually
via client.
Workaround:
Add a print statement directly above the compute with form line:
Print "About to do compute with form"

if you are using the 8.52 server or client add the line
Print "About to do compute with form"
directly above the compute with form statement for some reason any print or write statement fixes this issue.

The last scenario where a compute with form line may not work as expected is if there are fields that are not arrays that will become arrays when compute with form is applied and those fields are used as calculations for other fields. When this is the case you will sometimes, but certainly not always have to address those fields in your code specifically but if that is the case I don't believe your toolsRefreshALlDocs will work either.

Compute with form calculates computed fields. I prefer not to use it often because it is a lazy approach and is very very slow. My co workers are beginners at lotusScript, and because that is the case we do use that method in a variety of different database agents because if we did not they would be manually running ToolsRefreshALlDocs all the time which is just as slow and just as processor intensive.

Some methods you can use to avoid having to use Coimpute with form include:

Put the logic in the view not the document when dates are involved. Views get refreshed.

Write agents that include the logic of what you want done instead of using compute with form OR toolsRefreshAllDocs it is much cleaner faster and less processor intensive, and yes I did see at the top where you specifically said you did not like that type of solution. Like it or not it is better.

ComputeWIthForm is the only solution that meets your needs. That does not make it good, but it does make it the most correct answer to your question.

Thank you. I realize that my answer, while truthful and correct, was not what you wanted.

I should also include the solution of using Replica IDs in your dblookups, running the agents on a schedule locally instead of on a server, and having local replicas of the databases you are doing a lookup to. This is a very imperfect solution that depends upon good local replication, uses a local workstation to do enterprise level work, is susceptible to power outages, connectivity issues and the vagaries of local agents running reliably. There are many things to be said about it's imperfections, but we have used it in the past and may at some point use it in the future. In a perfect world we wouldn't but we have and could possibly in the future. So another solution may be to use replicaIDs in lookups and to have replicas. Sadly there is not another solution which handles that elegantly, the limitation of not accessing other servers with background agents is a huge problem when working with lotus notes. Good luck.

0

Featured Post

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

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…

In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication. Every Where from Works place to…

Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…