Solved

How do I grab cell values in a Lotus Notes table?

Posted on 2006-06-29
9
290 Views
Last Modified: 2013-12-18
I have an email that I setup with a table and button from Lotus Notes. I want to be able to send it to people within my company so they can fill out the table. When they finish filling out the table they click the button and an email gets generated and sent right back to me. I want to be able to grab the data they entered into the table and pull into that email that gets sent back to me but I do not want the whole table. Example:

Table filled out by company employee where column 2 and 4 is the employee's data:

Column 1                Column 2                    Column 3                Column 4
Store A                   456                            Store C                    323
Store B                   542                            Store D                    186

This is what I want back:
456, 542, 323, 186

Is there a way to do that?
0
Comment
Question by:GCortesJr
[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
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17014399
Yes, provided you send them a mail with a form, and they send you the form back as well. Design the form with the fields you need, then send it away with a doc.Send(True) or click Store form in document.
0
 
LVL 2

Accepted Solution

by:
TiwariVikas earned 400 total points
ID: 17020064
No need of sending the form with mail...

We can achieve the same functionality using RichText Navigators....

Try the following code which I have customized according to ur need
This code will send back a mail with the data entered in the table.


Suppose you created a table in mail like this...
1a      2      3      4
5fdg      vikas       tiwari      8d
9      10sdf      11csdf      dsfsdf

and a Submit button with following code....

Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim w As New NotesUIWorkspace       
      Dim doc As NotesDocument
      Dim uidoc As NotesUIDocument       
      Dim rtnav As NotesRichTextNavigator
      Dim rtRangeTable As NotesRichTextRange
      Dim rtNavTable As NotesRichTextNavigator
      Dim rtNavCell As NotesRichTextNavigator
      Dim rtRangeCell As NotesRichTextRange
      Dim rtRangePara As NotesRichTextRange
      Dim msg As String
      
      Set db = session.CurrentDatabase
      Set uidoc = w.CurrentDocument
      uidoc.EditMode = True
      uidoc.Save
      Set doc = uiDoc.Document
      If doc.TableFlag(0) = "" Then
            doc.TableFlag = "1"
            Call doc.Save(True,False)
            Set rti = doc.GetFirstItem("Body")
            Set rtnav = rti.CreateNavigator
            If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
                  Messagebox "Body item does not contain a table,",, _
                  "Error"
                  Exit Sub
            End If
            Dim rtt As NotesRichTextTable
            Set rtt = rtnav.GetElement
            Dim rtrange As NotesRichTextRange
            Set rtrange = rti.CreateRange
            Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
            firstFlag = True
            StrValue = ""
            For i& = 1 To rtt.RowCount
                  For j& = 1 To rtt.ColumnCount
                        If Not firstFlag Then
                              Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
                        Else
                              firstFlag = False
                        End If
                        Call rtrange.SetBegin(rtnav)
                        StrValue = StrValue & Chr(10) &  "(" & Cstr(i&) & "," & Cstr(j&) & ")" & Cstr(rtrange.TextParagraph)
                  Next
            Next
            Set mdoc = New NotesDocument( db )
            mdoc.Form = "Memo"
            mdoc.SendTo = doc.From(0)
            mdoc.Subject = "Reply from " & session.CommonUserName
            Set rtBody = New NotesRichTextItem(mdoc, "Body")
            Call rtBody.AppendText("Here is the response from " & Cstr(session.CommonUserName ))
            Call rtBody.AddNewline (1)
            Call rtBody.AppendText(StrValue)
            Call mdoc.Send( False )
            Set nam = session.CreateName(doc.from(0))
            Msgbox "A notification mail has been sent back to " & nam.common
      Else
            Msgbox "You have already submitted the document."
      End If
      
End Sub

The mail returned will be....

Here is the response from Vikas Tiwari

(1,1)1a
(1,2)2
(1,3)3
(1,4)4
(2,1)5fdg
(2,2)vikas
(2,3)tiwari
(2,4)8d
(3,1)9
(3,2)10sdf
(3,3)11csdf
(3,4)dsfsdf

Please let me know if this code is able to solve your problem.

Regards,
Vikas.
0
 
LVL 18

Assisted Solution

by:marilyng
marilyng earned 50 total points
ID: 17024102
Nicely done, vikas.. !  I was thinking that would be another way,  question, wouldn't you also need another agent to step through the response and convert it to the database?

for instance, (1,1) would have to convert to some fieldname, so when you process it in the receiving database, you would need an agent that would

1. collect "memo" or new entries mailed into the database (so you'd need to make the database a mail-in database)
2. Step through the body of each returned survey, and create a "new" document for this database using the values returned.
3. Mark the processed memo for archive, so it doesn't get processed again.
4. Add some key values to the sent form so you don't process it twice and create duplicates.
5. Add a check so that if the agent exits, or server is down and agent doesn't run, you have a way to step through your received surveys and check to be sure you have them all.

--------
Just a thought or two.. :)
0
Technology Partners: 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 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 50 total points
ID: 17024266
Interesting, indeed! It would never be my tool in this case. Just to mention a few more drawbacks:
- no control over the "form" (add or remove columns and rows? Or even whole tables?)
- no visible fields
- no field calculations
- no field validations
- no processing by field
- NotesRichTextNavigator available only since R6, and rather buggy
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17024387
True, and then there's the part where the user edits the table in the email and adds a row...? It does seem like a lot of work to try and catch all the errors when you can simply send a form or a button that opens a form.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17024618
Unless of course you don't have a Domino Designer for the form. Remains the question: how on earth am I going to create that wretched agent??
0
 

Author Comment

by:GCortesJr
ID: 17060472
Just wanted to let everyone that I am trying out the solutions provided and will update this call soon. Thanks for all the good responses so far!
0
 

Author Comment

by:GCortesJr
ID: 17167430
Sorry I didn't get back sooner to close this call out but the man has got me working hard lately. Anyways, TiwariVikas's code put me on the right track and got me real close to where I needed to go. marilyng & sjef_bosman gave me some food for thought for future planning. Thanks to all for the help.
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

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…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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