Hi there!
I have a LotusScript agent that writes HTML to a richtext field. The agent collects the html in a string and then assigns it to the richtext field. It seems as though the string is getting too big because it returns only the partial string. When I remove some HTML from the agent, it returns everything.
I thought of using the print statement, but there is a lot of other stuff on the page and to print it all from the agent would be overwhelming. Any ideas?
Thanks!
Gérald
Subject: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
You can try using the Compact method on your RichText Item after writing your text to it - sometimes seems to allow you to fit more in.
It also helps if you can split your string up into paragraphs, although I can’t remember how to do this off the top of my head. Perhaps do a search in here, or someone else can post how to define a paragraph in a rich text item?
Emily.
Subject: RE: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
Thanks for your response. However, I don’t think the problem is with the richtext field. I’m collecting all of the HTML in a string and then passing that string to the richtext field. I think the problem is that I’ve reached the limit on the size of the string.
Gérald
Subject: RE: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
You can use a array of strings if the issue really is the size limit.
Subject: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
Hi
When the string gets to a certain size why not just just call “AppendText” on the “NotesRichTextItem”? and work all over again on the string.
brgds
Jesper Kiaer
http://www.jezzper.com
Subject: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
Are you positive that the field you are writing to is actually a rich-text field? Neither the string data type nor the rich text field have size limitations other than available memory so I very much doubt that you are populating it with too much data.
Maybe post your code and we could help you.
Subject: RE: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
Hi Dave:
Here is the code:
Sub ArtsAndCulture
Dim ArtsAndCultureResult As String
ExpertiseCount = 1
Set ExpertiseColl = ExpertiseView.GetAllDocumentsByKey("Arts and Culture")
Set ExpertiseDoc = ExpertiseColl.GetFirstDocument
Redim Expertise(1 To ExpertiseColl.Count)
While Not ExpertiseDoc Is Nothing
FieldOfExpertise = Trim(ExpertiseDoc.prEngFieldOfExpertise(0))
Expertise(ExpertiseCount) = FieldOfExpertise
ExpertiseCount = ExpertiseCount + 1
Set ExpertiseDoc = ExpertiseColl.GetNextDocument(ExpertiseDoc)
Wend
ShellSort Expertise
n=1
While n < ExpertiseCount
ArtsAndCultureResult = ArtsAndCultureResult + "<tr id='expertise" + Expertise(n) + "'><td width='30'></td><td>" + Expertise(n) + "<table class='content'>"
Set ExpertiseMembersColl = ExpertiseMembersView.GetAllDocumentsByKey("Arts and Culture_" + Expertise(n))
If ExpertiseMembersColl.Count > 0 Then
ExpertiseMembersCount = 1
Set ExpertiseMembersDoc = ExpertiseMembersColl.GetFirstDocument
Redim ExpertiseMembers(1 To ExpertiseMembersColl.Count)
Redim Telephone(1 To ExpertiseMembersColl.Count)
Redim Extension(1 To ExpertiseMembersColl.Count)
Redim Office(1 To ExpertiseMembersColl.Count)
Redim Email(1 To ExpertiseMembersColl.Count)
Redim UNID(1 To ExpertiseMembersColl.Count)
While Not ExpertiseMembersDoc Is Nothing
UNID(ExpertiseMembersCount) = ExpertiseMembersDoc.UniversalID
ExpertiseMembers(ExpertiseMembersCount) = ExpertiseMembersDoc.LastName(0) + ", " + ExpertiseMembersDoc.FirstName(0)
Telephone(ExpertiseMembersCount) = ExpertiseMembersDoc.Phone(0)
Extension(ExpertiseMembersCount) = ExpertiseMembersDoc.Extension(0)
Office(ExpertiseMembersCount) = ExpertiseMembersDoc.Office(0)
Email(ExpertiseMembersCount) = ExpertiseMembersDoc.Email(0)
ExpertiseMembersCount = ExpertiseMembersCount + 1
Set ExpertiseMembersDoc = ExpertiseMembersColl.GetNextDocument(ExpertiseMembersDoc)
Wend
ShellSort ExpertiseMembers
z=1
While z < ExpertiseMembersCount
If Office(z) = "" Then
OfficeText = ""
Else
OfficeText = "Office: " + Office(z)
End If
If Extension(z) = "" Then
ExtensionText = ""
Else
ExtensionText = " ext. " + Extension(z)
End If
ArtsAndCultureResult = ArtsAndCultureResult + "<tr><td width='30'></td><td><a href='DirectoryMain/" + UNID(z) + "?OpenDocument'>" + ExpertiseMembers(z) + "</a><br>Telephone: " + Telephone(z) + ExtensionText + "<br>Email: <a href='mailto:" + Email(z) + "'>" + Email(z) + "</a><br>" + OfficeText + "</td></tr>"
z = z + 1
Wend
Else
ArtsAndCultureResult = ArtsAndCultureResult + "<script>document.write(document.getElementById('expertise" + Expertise(n) + "').style.display='none');</script>"
End If
ArtsAndCultureResult = ArtsAndCultureResult + "</table></td></tr>"
n=n+1
Wend
doc.ArtsAndCulture = "[" + ArtsAndCultureResult + "]"
End Sub
Subject: RE: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
ArtsAndCulture is not a RichText Field. You mut set a new NotesRichTextItem to do what you want.
Subject: RE: LotusScript Agent fails when writing HTML to RichText field. Too much data. Any Advice?
To clarify Cesar’s answer:
The assignment doc.fieldname = value cannot be used to create or assign a rich text item. This creates a text item (or number, or date, depending on the datatype of value). It doesn’t matter that the field is defined as rich text on a form. You’re working in the back end, which pays no attention at all to your form.
A document is a free-form container for items. Any document can contain any items, using whatever name, datatype and value you like. You control both the horizontal, and the vertical hold. If you say to create a text item with a given name, Notes will do so, regardless whether some form exists somewhere with a field of the same name.
Forms are only used during editing on-screen*. When you save, then the defined datatypes of the fields are used to control the types of the items created (though you can even override that with an input translation formula). The field datatypes on a form are just suggestions.
Read the help about the NotesRichTextItem class and the examples there.
- also when you call ComputeWithForm or commands such as @Command( [ToolsRefreshAllDocs] ), but neither of those will help you here.