Frank Zhang
Frank Zhang

Reputation: 137

Lotus Notes: How to show up Rich Text Field in a view? For existing documents

I have some Rich Text Fields in a form definition. It is really just Text. I want to show it in a view but cannot find the field when I add a new Column.

I searched a lot and find out that Rich Text cannot be shown up directly in a view.

Then I found this idea to have a hidden field as a computed field with formula defined as @Abstract([TextOnly];60400;"","FieldName")

But this only works if a new document is created or changes are made for a document. I have almost over 25k documents and it is not practical to do that manually.

Is there anyway to make the hidden computed field got recalculated? Or any other way to show a Rich Text Field in a view?

Upvotes: 2

Views: 6708

Answers (2)

PoisonedYouth
PoisonedYouth

Reputation: 548

You can write an Agent witch runs over all documents in view with the following code:


        Dim session as new notessession
    dim db as notesdatabase
    dim view as notesview
    dim doc as notesdocument

    set db = session.currentdatabase
    set view = db.getview("")
    set doc = view.getfirstdocument()
    while not doc is nothing
        Call doc.computewithform(true, false)
        Call doc.save(true,true)

        Set doc = view.getnextdocument(doc)
    wend

But with running this agent you will change the last modified date of the documents. If it is important to save the date you can write it in an other field and display it.

Upvotes: 0

Knut Herrmann
Knut Herrmann

Reputation: 30970

You have a hidden field already which gets the text only part of the RichText field. That works for new documents or documents which got edited.

Write a formula agent which sets the hidden field to all other documents. It would have a formula

SELECT @All; 
FIELD FieldNameTextOnly := @Abstract([TextOnly]; 2000; ""; "FieldName");
""

and the Target option "All documents in view". Go to the view which contains all 25k documents and start the agent.

Then add a column for your hidden field "FieldNameTextOnly" to your view if you haven't already.

Be a bit careful with the number of characters you want to get from RichText field as those will be part of calculated view so the view might get very large ...

Upvotes: 4

Related Questions