1,055 pts.
 How to get no. of items appended into rich text field
I want to know the count of total no. of lines of text appended into rich text field i.e  history field.

There is a rich text field to track the history of editing the document.

Every time the document is modified i.e. changing any of the fields the information is appended into the rich text  field.

But it is not tracked that how many items are appended i.e how many times editing had been done in old documents. So, there is a requirement to know in how many documents the no. of editing is more that 100. How this can be done.



Software/Hardware used:
Lotus notes, lotus script, no. of lines appended in rich text field
ASKED: April 12, 2012  8:46 AM
UPDATED: April 26, 2012  7:41 PM

Answer Wiki:
Thanks guys. It is clear from Edvabnik given script that this can be done as : considering doc as object of notesdocument and richtextfield as fieldname of rich text type. set item =doc.getfirstitem("richtextfield") dim count as variant count=item.values msgbox ubound(count) This really works! Thanks Edvabnik.
Last Wiki Answer Submitted:  April 18, 2012  10:22 am  by  shivasanjay   1,055 pts.
All Answer Wiki Contributors:  shivasanjay   1,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

 

I have created a memo with this agent:
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtItem As NotesRichTextItem
Dim i%
Set doc = s.CurrentDatabase.CreateDocument
doc.Subject = “100 Lines in Body”
doc.SendTo = s.UserName
Doc.Form = “Memo”
Set rtItem = doc.CreateRichTextItem(“Body”)
For i = 0 To 99
Call rtItem.AddNewline(1, True)
Call rtItem.AppendText(Str(i) + ” line in Body is here yxdvyxcvyxcv yxcv yxcv yxcv yx cvyx cv”)
Next
Call doc.Save(True, False)
Call doc.Send(False)
End Sub

Then I could count the number of lines in the body field of this memo with the following agent:

Sub Initialize
Dim s As New NotesSession
Dim doc As NotesDocument
Dim rtItem As NotesRichTextItem
Dim item As Variant
Dim plainText$, vTmp

Set doc = s.CurrentDatabase.UnprocessedDocuments.GetFirstDocument
If Not doc Is Nothing Then
If doc.HasItem(“Body”) Then
Set item = doc.GetFirstItem(“Body”)
If item.Type = 1 Then
Set rtItem = doc.GetFirstItem(“Body”)
plainText = rtItem.GetUnformattedText( )
vTmp = Split(plainText, Chr$(10))
Msgbox Str(Ubound(vTmp)) + ” strings were found in Body”
End If
End If
End If
End Sub

Best regards

 75 pts.