|
How to work with two Lotus Notes databases in one mobile iOS App with Domino To Go
Today I needed to prepare myself for a presention of Domino To Go. The client asked me if it's possible to work with two NSF databases in one mobile App. Instantly I said "yes!", but nevertheless, I wanted to prove it. So I quickly build an example as follows:
1.) I copied the small demo App coming in the Domino To Go package to a new project. This demo App already synchronizes the content of the "people" view of a standard Domino address book to the iPhone or iPad and displays it on the device. 2.) I renamed the file "navigation.js" to "navigation_db1.js" and duplicated that to "navigation_db2.js". The navigation.js contains code to build the view in the mobile App. I changed some variable names in both files to reflect that one is for "db1" and the other is for "db2". 3.) In "app.js" I added one more tab to the tabgroup, so that one tab opens the view of "navigation_db1.js" and the other the view of "navigation_db2.js". 4.) In "navigation_db2.js" I changed the creation of the NotesDatabase object so that is uses a NotesDatabase with the name "contacts2" instead of "contacts". 5.) In "sync.js" I added code to instanciate a second NotesDatabase object with the name "contacts2" and a different URL, and to update the people view from that seconds database. Here is the full code of sync.js. You can see that in sync(), the view of the first database is updated (synchronized). Then sync_2 is called (via callback), which updates the view of the second database. And basically that was it. I needed to change some variable names here and there, but in general, the changes above did the job. It was a work of minutes, super easy. This example shows how super flexible Domino To Go is. You can work with multiple Notes database, you could even mix Notes data with data from other data sources. With Domino To Go, you have the power to do it the way you like. Here are two screenshots: you can see two views in the App, each view displays contacts of another NSF database. |
