PreviousNext…

Tip #8: set a user's default view

Introduction

Oh this is a really quick and easy one, but has been surprisingly popular with users! In fact, it's downright noddy. Anyway, it all boils down to this:

  • Frameset-based application (i.e. view to the right, outline to the left) in the Notes client
  • Notes launches the database to this frameset, and there's a default view
  • The database is "modular" in that sections can be switched on and off. Also, some users might want it to open to the discussion section, others may be more interested in say, bulletins
  • Why not offer them the chance to set their "preferred view" for the application?

It's so easy. The right hand pane of the frameset (i.e. the one that contains the relevant view, folder, page, whatever) should be computed. Something like this:

strName := @DbTitle + "DefaultView";
strEnvVar := @Environment(strName);

@If(strEnvVar = ""; "YOUR_DEFAULT_VIEW_OR_WHATEVER_NAME_HERE"; strEnvVar);

You then want some kind of mechanism for the user to set their preference. I used a shared action in all relevant views with the following code behind it:

strVarName := @DbTitle + "DefaultView";
@Environment(strVarName; @ViewTitle)

That's it! See, I told you it was easy. But I sometimes like the simple things. After all, I'm a simple soul. So, go ahead, tweak away…

Comments

  1. With R6 we have @ReplicaID. Why not use that to prefix Environment var. If the title changes it will still work. Of course if the replicaid changes it stops working, but at least its unique, unlike the title.
    @ReplicaID has other uses in @DBLookups for example.John Marshall#
  2. Very true Mr. M! But you know me, I'm no details man ;-) Ben Poole#
  3. I've used this technique for years in our framed apps. You've got it pinned - incredibly simple to do, but more appreciated by users than the most complex code.Esther Strom#

Comments on this post are now closed.

About

I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.

";