Tuesday, January 3, 2023

Data Extraction Help for Rich Text Field

Preamble:

This post is being written more for my long-term memory benefit than for its genius of development.

A customer wanted to export their data from an NSF to import into Salesforce.

They thought they could just export the view.

Sure, if the view had all the data, which of course, it did not.

Thus how it ends up in my inbox.

Action:

I created a view and proceeded to add a column for each field in their form.

No problem, done this many times.

When I verified the data before giving it to them, I found it was missing one field.

For unknown reasons, one can not see rich text in a view column even when specifying the field. Oh, and you can't specify a rich text field, either.

Developer friends are shaking their heads, they understand, but us admins, we figure it should just work, right?

Work Around Solution:

UPDATED EDIT: Thomas, in the comments pointed out, rightly so, that "Rich Text items can contain not only formatted texts, but tables, images, file attachments and more. But the abstract item will only contain the unformatted text." 
In this case, my client only has some textual notes in the field, but if they had other items, you should seek a proper developers help.

This is what I did after mentioning it in the openntf.org Discord chat, where I learned about the @abstract formula.

I used Jake's blog post, from 2001, http://www.codestore.net/store.nsf/unid/DFOU-4PRG73?OpenDocument, as the guide. But that was only one part of the story, and I had to fix the code.

Jake wrote: First thing to do is to create a Computed field, of type Text, and call it something like "Abstract". The formula for this will be somthing like :

@If(@IsAvailable(name_of_the_rt_field); @Abstract( [Abbrev]; 200; ""; "name_of_the_rt_field");"" )

Jake included a * at the end of the formula. My designer client balked at it, so I removed it, and it accepted the code as shown above.

I added a field to the original form, called it Abstract, and set it to type Text and Computed field.

Then entered the formula, substituting the name of my Rich text field, where Jake wrote name_of_the_rt_field.

I also changed the 200 to 2,000, so I could get all the text in the field. 

Saved it all, refreshed my view, and ..... nothing.

2nd Part Work Around Solution:

Further Googling found that the rich text field would only show up now if it was resaved.

I tested this, and sure enough, I resaved a form and magic, the rich text was shown in my view.

Great, but, I can't re-edit all 1,500 documents, nor know even if they have anything in the rich text field without opening it, so what do I do?

I asked Bruce Lill what he uses, and he said to create an agent, with a Forumla and a target set to none.

The formula to include is @Command([ToolsRefreshSelectedDocs])

And after saving it, selected a few forms and ran the agent, and now the rich text shows up.

And I can give the client their data for importing into Salesforce.

Conclusion:

Domino developers have dealt with this for many years and created workarounds for it. Admins have just lived in pure ignorance all this time about this issue.