Property Get/Set DocumentContext As NotesDocument
Any formula requires a context to get properly evaluated. Frequently a formula use username or document fields. If a hide-when formula contains @Username and agent runs under other person's or server identity you will not be able to hide/show paragraph for a specific person. It may be a case that the value of the formula depends on fields in particular document; by default the context for formula evaluation is the last document that the particular rtContainer object has accessed – either by using getRichTextItem method or by using AppendItemValue or ReplaceItemValue methods.
However you can force which document to use by setting:
Set rtLibSession.documentContext = doc
where doc is the NotesDocument in whose context you want to the formula to be evaluated.