If you have agents that print a large amount of HTML/XML (concatenating into a string), one workaround is to check the string-length frequently:
If Len(yourString) > safeNumber Then
Print yourString
yourString = ""
End If
Where yourString is the string containing the HTML/XML/etc., and safeNumber is a number that is smaller than the 64k - the maximum amount of characters you can imagine is added per concatenation.
If there is A LOT (5000+) of string concatenation in the agent, I suggest using Julian Robichaux' StringBuffer class. You would have to add a getLength-method, to check the length of the buffer.
Something like this:
'in stringbuffer class
Public Function getLength() As Long
getLength = Len(buffer)
End Function
'in the printing agent
If bufferObject.getLength > safeNumber Then
Print bufferObject.toString()
bufferObject.erase()
End If
The above If-statements .. > safeNumber .. should be put inside the loop that you use to concatenate the string. Thanks for making me aware of the bad "documentation", Thomas.
If you have a lot of different content you want to print, I'd suggest having one agent per content-type, and that the agents only contains method calls to their respective script libraries (which in turn can use other scriptlibs). Having 20+ agents in an application quickly gets messy (at least from my point of view).
Example:
..xml?OpenAgent&action=report&type=wages&employeenum=2134212
In agent (untested code):
Use "PrintXML"
Dim s As New NotesSession
Dim action As Variant
action = Evaluate( |@UrlQueryString("action")|,_
s.DocumentContext)
'the evaluate above returns a text-list with one item
Select Case( action(0) )
Case "report"
Call report( s.DocumentContext )
End Select