?
Solved

Update field in Notes

Posted on 2003-11-26
7
Medium Priority
?
296 Views
Last Modified: 2013-12-18
Dear Experts,
I have 2 form A and B. Form A contains 1 field named A1. Manager creates form A for 1 time only. This is common information.
Form B import field A1 from form A. Employee create new form B, field A1 is automatically imported.
My issue is: when Manager modifies field A1 (form A) and save, I want existing documents of form B will be updated (field A1).
Please help me. Thanks
0
Comment
Question by:phuongnguyen
[X]
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
7 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 9830022
Then u need to write a lotus script to update all the documents.

or Formula:
run once through action buttons.

Which one u prefer?
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 280 total points
ID: 9830041
Formula:

I consider ur  going to store formA document in a view.

so,
FIELD field A1:=field A1;
res:=@Dbcolumn("":"NoCache";"";"urViewname";1)
@SetField("field A1";res)

The above paste in an agent and Runfrom agentlist and on all documentsinview

name it as UpdateAgent

and in the action button, where formB documents reside in a view,
@Command([ToolsRunMacro];"UpdateAgent")

Test it and implement.

If u want script, its also easy.
0
 

Author Comment

by:phuongnguyen
ID: 9830085
Could you please provide me a script? Thanks so much.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:madheeswar
ID: 9830095
Let me type it. And I will post it here.

And formulas will be easy to implement ratherthan script.

Its upto u. Anyway, I will try to do it within 30mnts.

0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9830109
Sub Initialize
      Dim ss As New notessession
      Dim db As notesdatabase
      Dim view As notesview
      Dim doc As notesdocument
      
      
      Set db=ss.currentdatabase
      Set view=db.getview("FormBviewname")
      Set doc=view.getfirstdocument
      
      tmpupdate=Evaluate(|@DbColumn("":"Nocache";"";"FormAviewname";1)|)
      
      While Not doc Is Nothing
            doc.Field A1=tmpupdate(0)
            Call doc.Save(True,True)
            Set doc=view.getnextdocument(doc)
      Wend
End Sub

Follow the same procedure as I told u before to implement Agent.

Any queries, let me know.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9831949
Simply Make your B1 field  a computed field. With formula

temp := @DBLookup( "Notes":"NoCache"; @DBName; "View where I can find Form A values"; "Key value"; "FIELDA1");
@if(@IsError(temp); ""; @Unique(temp))

You pass the viewname in above formula  and a key value to find the specific document in that view (this is the I column sorted asc/desc)

Now Create an agent which will run on all docs in database and with search criteria set to look for form = "FormB" and with LotusScript like this

Dim session as New NotesSession
dim db as NotesDatabase
dim col as NotesDocumentCollection
dim doc as NotesDocument

set db = session.CurrentDatabase
set col = db.UnprocessedDocuments
set doc = col.GetFirstDocument

While not doc is nothing
  doc.ComputeWithForm true, false
  doc.Save true, false
  set doc = col.GetNextDocument(doc)
Wend

In this manner you can set all the fields that will compute the field in the form B to look at form A and run this agent either when doc is created/modified or trigger it manually when form A is saved..

~Hemanth
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9833331
Why bother keeping the A1 value on form B at all?  Retrieve it dynamically when the form opens.  On form B, make A1 a computed for display field.  The formula would be @GetDocField(@Text($Ref); "A1")

Teh above will work if B is a "response" form.  Otherwise, you need a field, computed when composed, called FORM_A_UNID.  The formula for this field would be @Text(@InheritedDocumentUniqueID) and teh formula for A1 (still computed for display) would be @GetDocField(FORM_A_UNID; "A1")

If the form B value needs to display in a view, the above will NOT work, because computed for display fields are not saved on the document (which is what allows them to be looked up every time you open the document).

In that case, assuming B is a response form, the following QuerySave script on form A will do the trick:
Source.document.responses.stampAll "A1" , Source.document.A1

If B is not a response form, the formula is MUCH more complicated, and I would need more details about how A and B are tied together.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 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