Thursday, October 11, 2007

Getting Domino Databases to Work on Mobiles without Extra Technology - Part 2

As promised last time, I'm going to have a look at views.

Suppose we decide to have a view called ITContacts.

We will also need a form called $ViewTemplate for ITContacts.

We can't change the $ViewTemplateDefault form because changing this will affect other web views of the database. Of course, if your database isn't otherwise available on the web, you can save yourself some trouble because otherwise you'll need to create a $ViewTemplate for each view that will be available on the mobile.

Tips for the View
Creating this view is pretty much the same as creating any other Notes view except that you need to be conscious of how much data you're pushing out.

For example;
Your normal web or notes view of IT Contacts might have;
|FirstName | Surname | Company | Phone | Fax | Mobile | Email | Support ID | Address | City | State |

This is fine for a wide screen but isn't at all useful on the mobile.

Concatenation
Consider concatenating fields; eg:

Instead of the first two fields, try...

@IF(@Trim(FirstName) != "" ; FirstName + " " + Surname ; Surname)


Use HTML to Spread out Vertically
Instead of having a whole heap of columns, consider doing everything in two but using HTML to space things out more neatly.

Your first column would be the link to from the view to the full document. Just make it something small - even an "X" would do the trick.

Your second one would contain useful things...



Obviously your html would be more polished than this, you'd use an @IF like the firstname bit to check whether the Email address existed before writing the html for it.

The end result would be that you end up with a view that displays each record on the web like this.

X Roger Wilco
Space Janitors
Phone: 06 9506 5080
Fax: 06 9059 8905
Email: rwilco@spacejanitors.com

instead of a columnar format.

Obviously the views would be slightly different for different databases.
Note also that we've ignored the address. If you can, you should try to suppress unnecessary information on the VIEW, save it for the form.


The $ViewTemplate for ITContacts.
This is just a normal notes form with an Editable text field in it called $ViewBody

The important thing is how you structure your menus.

Here's an example of how I did my form - the links go nowhere though.

IT User Manual - IT Contacts
Menu | Prev Pg | Next Pg | Search


[$$VIEWBODY]



Menu | Prev Pg | Next Pg | Search

Other IT Books
IT Contacts
Systems
Inventory
Statistics
Disaster Recovery


The Menu Link should go to:
Named Element, Page, Mobile

The Search Link will contain formula similar to the following;
DB:= @Implode(@Explode(@Text(@Subset(@DbName;-1)); "\\");"/");
SearchURL := "/"+DB+"/msearchdb?Openform";

@URLOpen(SearchURL)

(for more info on the search facility - see How and Why to use Different Search Templates in Domino)

The Other IT Books links will contain links going to;
Named Element, View, Mobile\Contacts etc..

That leaves only the Prev Pg and Next Pg Links.
These should have formula for...

@DbCommand("Domino"; "ViewPreviousPage")

and

@DbCommand("Domino"; "ViewNextPage")

respectively.

Note that I haven't been able to get these two commands to work on Opera Mini or the Blackberry Browser even though they work fine in a normal browser. When I have an update on this, I'll post it.


I haven't covered forms, because there's not a lot to do with them. I suppose you could try to launch a different form from the mobile views... (one with less graphics). I'll consider it as a future project.

Notes also has a "hide when" for Mobiles which would be good for graphics if phones were reliable. Apparently the blackberry doesn't see itself as a mobile browser.

So... There you have it. Who needs a fancy API (or even a Blackberry) to get things working on the Mobile?

No comments: