Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

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

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
GCortesJr
Asked:
GCortesJr
  • 3
  • 2
  • 2
  • +1
3 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
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
 
TiwariVikasCommented:
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
 
marilyngCommented:
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
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!

 
Sjef BosmanGroupware ConsultantCommented:
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
 
marilyngCommented:
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
 
Sjef BosmanGroupware ConsultantCommented:
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
 
GCortesJrAuthor Commented:
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
 
GCortesJrAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now