Need to pick values from the view and assign them to the fields in the form.

5 pts.
Tags:
Domino Designer
I am new to Lotus Notes. I need to write an agent to pick the values from the view and place them in the fields in the form. Please help me in this.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Your question is a little vague — could you please outline your requirements in more detail? (unless the previous answer below tells you what you need)
—–
Hi,

We can populate the values into the fields in the form by referring a view by using Lotus Script agent.

1. Create a form with 2 fields “RNum” and “Combination” which should get populated with the values from the view “Student Details” (where “RollNo” is the first sorted column of the view)

2. Write an agent “PopulateFields”

Option Public
Option Declare

Sub Initialize

Dim session As New NotesSession
Dim currdb As NotesDatabase
Dim currdoc As NotesDocument
Dim view As NotesView
Dim viewdoc As NotesDocument

Set currdb = session.CurrentDatabase
Set currdoc = session.DocumentContext
Set view = currdb.GetView(“Student Details”)
‘ trying to the fields RNum and Combination in the form with the values for the RollNo = 1870 from the view
Set viewdoc = view.GetDocumentByKey(“1870″, True)

If Not viewdoc Is Nothing Then
currdoc.RNum = viewdoc.RollNo(0)
currdoc.Combination = viewdoc.Combination(0)
Else
currdoc.RNum = “”
currdoc.Combination = “”
End If

End Sub

3. Call this agent as a WebQueryOpen

ALL THE BEST

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Rrcdvs
    Sai, your question suggests a basic lack of understanding of the structure of a Notes database. Fundamentally a Notes database has three primary objects. There are more than three but for our purposes we'll focus on three, Document, Form, View. A document can be thought of as a data record. A form is the primary means of creating or interacting with a document, but it is important to understand the relationship between a form and a document is loose and flexible. A view can be thought of as a list of documents in the database. Views are the primary way of locating and accessing documents. So, a row in a view represents a document(data record). If you double-click a view row, the Notes client opens the document and displays it in a form. Due to the loose relationship between the form and the document it is possible for the document to contain fields which are not defined on the form and thus can't be seen on the form when the document is opened in the form. Your question leads me to believe that you may have fields which display in a view but which do not display in the form. In the event I am correct, there are two reasons why this might be so. First, like I said above, the document has a field (which displays in the view row), but the form does not have the field so the data in the document field does not display on the form. Second, view columns can be "computed" meaning the data which displays in a view column may not be data in the document. View columns can display the results of a "calculation" which could be as simple as the concatenation of two fields or the results of a complicated formula which creates a data value which is unique to the view and will not display on the form. If you have values in a view column which do not display on a form, given the right circumstances, it is possible to add a field to the form which will display the value from the view column. You first need to know what document field is the source of the data in the view column. Then you can create a field on the form which has the same name as the document field. If the field is set to be editable then the value from the document field will display on the form when the document is opened. If the field is "computed" then the field can be named anything but it's Default Value must be the name of the document field. With all of that said I may not have even come close to answering your question. If not try again and I'll do the same.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following