Search

What the Quote?

"Don't tell me what to do, I'll drink sugar water."

Laura Tripcony

"You can't light cigarettes with chapstick... I've tried, it doesn't work."

Pete Oberlin

"You're giving Mommy a face bath... so now she'll stink like you."

Tim Tripcony

« SnTT: Unlink individual design elements from a template | Main| Finding the remote »

Example of using LS:DO to connect Domino to other systems

Category domino
Here's another forgotten "gem". T'other night I was talking a friend through configuring Domino on Linux (getting inbound and outbound mail routing as desired, setting up Internet site documents to route users to different databases depending on hostname, etc.), and he brought up something experimental I'd written for him a couple years ago but we'd never gotten around to implementing: an agent that parsed incoming email and updated records in a MySQL database based on the email content. At the time, I considered the LS:DO classes to be kind of a pain in the ass to use, so I encapsulated some of their basic functionality into some wrapper objects, but had forgotten all about that until he mentioned it again.

I wasn't even sure I still had that old code, but I found it on the SD card in my Treo... so I threw together a quick CD Collection database that maps directly to the "cdcol" example database that's included with the default installation of XAMPP, and plugged in the LS:DO wrappers to allow synchronization between the two (for example, the QuerySave of the form automatically writes the document to MySQL - as an insert if it's a new document, otherwise as an update). Here are the highlights:

Let isNew = document.IsNewNote
Let title = document.GetItemValue("Title")(0)
Let artist = document.GetItemValue("Artist")(0)
Let cdYear = document.GetItemValue("Year")(0)
If isNew Then
    Let id = Me.getNextId()
    Call document.ReplaceItemValue("ID", id)
    Call Me.getDSN().issueInsertStatement("cds", {'} & title & {','} & artist & {',} & cdYear & {,} & id)
Else
    Let id = document.GetItemValue("ID")(0)
    If (Me.getDSN().issueSelectStatement("cds", {id}, {id = } & id, "").numRows > 0) Then
        Call Me.getDSN().issueUpdateStatement("cds", {titel = '} & title & {', interpret = '} & artist & {', jahr = } & cdYear, {id = } & id, "")
    Else
        Call Me.getDSN().issueInsertStatement("cds", {'} & title & {','} & artist & {',} & cdYear & {,} & id)
    End If
End If


You can download the example database here.

Comments

Gravatar Image1 - Tim, I'm already working on converting your code to LC LSX. Emoticon

Gravatar Image2 - Wow, that IS pretty cool. I feel compelled to mention, however, that real people should really not use LS:DO for real work. It's been WAY deprecated for many years now. Funky object model (I could tell you stories), never particularly stable, and only works with ODBC.

For real db access from LotusScript, you should really use the Lotus Connectors instead. The object model for those is no picnic either, but it does work, and it's supported. There's even a toolkit in case you want to write your own connector.

Gravatar Image3 - LS:DO lives ! Amazing, though I, of course, concur with Bob. I remember the magic of importing xls files through LS:DO when I worked with EDS (a long time ago). It was so nice to break through the silos. Of course, it was an absolute mess to maintain, and took forever to pull in 30,000 rows.

Thanks for stretching the imagination.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)