Misc. Resources

Specified Mini-Lesson

MIDAS#8 Out of Notes Part 1: The Challenge (Midas Rich Text LSX)

Out Of Notes, Part 1: The Challenge introduces a new sample database called Curb Appeal*, which has a number of real estate listings. Each listing has a complex set of data including numbers (how many bathrooms, how many car garage, etc.), text (architectural type, school distrtict, etc.) and multiple rich text fields (photo of house, bullet lists of highlights).
The challenge is to take this data and present a snapshot of a single listing (document) in Microsoft's Web Archive format, a MIME format which allows all the data including images inside a single file which you could mail to someone. It requires Internet Explorer to view, but that is an acceptable constraint in many corporate workplaces.
The agent used for the export is shown below. This agent will work in both Midas V4.32 (to be released today) and Midas V5 (to be released soon).

This sample requires Midas 4.32 or higher.

AGENT: Export whole document to Web Archive (*.mht)
' *** Get the collection and cycle through each selected document
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
If collection.Count = 0 Then Exit Sub

Call MakeDirectory(EXPORT_DIRECTORY)

' *** Create a temporary document that is never saved, just for rendering
Set tempdoc = New NotesDocument(db)
tempdoc.Form = "temp Form"

Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)
Set notes_rtitem = New NotesRichTextItem(tempdoc, "TempBody")
If doc.RenderToRTItem(notes_rtitem) Then
Set rtitem = New GeniiRTItem
Call rtitem.ConnectBackend(tempdoc.Handle, "TempBody")
If rtitem.IsConnected Then
If Left(session.NotesVersion, 9) <> "Release 5" Then rtitem.Everything.ConvertBitmaps
Call rtitem.ExportToMime(filename, |Content-Type: text/html; charset="iso−8859‒1"|, |charset="iso−8859‒1"|, _
|CSSBorders='Yes' MakeURLHotspots='Yes' charset="iso−8859‒1" ForceFontFace='Yes' AddNewlines='CRLF' RespectHiddenFormulas='Yes'
PreserveTabs='8' EvalHandle=|+CStr(doc.Handle))
Print "Exported '" & doc.Subject(0) & "' to " & filename
End If
Delete rtitem
Call tempdoc.RemoveItem("TempBody")
End If
Set doc = collection.GetNextDocument(doc)

' *** Throw away the unsaved temporary document
Delete tempdoc
Set tempdoc = Nothing

Rough transcript (used for Closed Captions as well):
This is Ben Langhinrichs from Genii Software with Part 1 of "Out of Notes", a series I am doing on taking structured data like this out of Notes in various ways.

The Curb Appeal database will be a sample database I'll release shortly. In it there are a number of real listings for houses in my area, sold by various agents and with a lot of the structured data you might see in a Notes database, from rich text to numbers to text.

Here we have the fields that are shown, a rich text field for the photo, and again rich text fields with bullet items down below. There's a fair amount of complexity to get out.

This is the challenge we face, how to take this out, either as structured columns, or in this case we are just going to do a snapshot.

If we look at the Listing form, we can see there are among the other fields, you've got computed images, which in this case is the agent's photo. And so this kind of thing also needs to come out. It's data that's not directly on the form, but is computed from the form. So we need to handle that sort of thing, as well as hide-when formulas. And we need to pull in the image resources that are necessary.

We're going to go to the Web Archive format. In that format, all this stuff will show because all the images will show, but you'll need to have, for instance, both the photo of the house which in each one of these is a different one, but also the photos of the agents.

So, if we look over here to where we exported to MHT, which is the Web Archive Format, it has all the pieces of information that you would expect it to have. It's a MIME format, so it is all in one file, and that's our snapshot.

I'm just going to go back here, and see that the format looks very, very close. We've worked a lot on fidelity to make sure that when you have a snapshot view, you'll see all the things the way they were intended inside the Notes document.

Thanks for watching, and stay tuned as further parts of the Out of Notes series show going to different formats and in different collections.

Copyright 2014-2022 Genii Software Ltd. All Rights Reserved.