logo

Tip Three: Towards the "perfect" view

Since I first learnt about the base tag's href attribute I have used it in every single database I've written. If you don't already, I suggest you start. It saves endless amounts of time and code!

If you have views treated as HTML you will need create the links yourself. I've seen people do this and include the following code as part of a column's formula:

@ReplaceSubstring( @Subset( @DBName; -1); "\\"; "/");

Who knows what damage this can cause in a database when you move folders. Not to mention the impact on indexing performance. Well, when you use the base href method, you don't need the database's path as part of the link. Just the view name, as below:

View named all

Alternatively, you could always just start the link with the "0" view name, like below:

View named 0

But sometimes there's a reason to use the actual view name in the link. To avoid hard-coding the view name in the links you can use the @ViewTitle, like below:

View named anything

Notice we used @Subset to always get the last element in the view's list of names, which will be the alias that we want and not its full name. If there's only one name and no alias it will simply return this name.

You could argue this is just as much a drain on the indexer as the @DBName method. Maybe so, it's just something I've started doing more and more thought it worth passing on. If nothing else, you might have learnt a trick to find the alias of a view ;o)

Which reminds me; Februaury's article is going to be called something like "Towards the perfect view". Laurens Lochtenberg of Iqinfo is working on it as we speak.

Comments

  1. Jake.

    You still need to convert any spaces in your view title (if you use them) to %20 otherwise your links will not work in some browsers e.g Firebird

    I still prefer to use base tag just for the leaner HTML page.

    Err and one slight spelling mistake for the word February.

    John Z

    • avatar
    • Jake
    • Wed 14 Jan 2004 07:00

    What do you mean? Aint' that how you say Februauaury ;o)

    I always assume that, if there's an alias for a view, it won't contain a space anyway. I tend to name views with spaces and then make sure there's always an alias and that it's "web safe".

  2. Jake,

    What do you mean by "web safe" view aliases?

    • avatar
    • Nick
    • Wed 14 Jan 2004 08:47

    Wayne,

    Presumable a web safe alias is one without any spaces in.

    • avatar
    • Jake
    • Wed 14 Jan 2004 08:48

    Wayne. Please see Nick after school.

  3. I thought you said you were updating to ND6, Jake. Take a look at @WebDBName.

    • avatar
    • Jake
    • Wed 14 Jan 2004 11:28

    I am Stan. And I do use @WebDBName. The reason I didn't in this example is that I was merely talking about what I've seen other people code in their columns.

  4. I just don't like @WebDBName personally. It doesn't allow you to step backwards through your URI - unless I'm missing something there's not a way to define a specific database's 401 page once you've "left" the database in question. I'll explain:

    Let's say you're running two web apps, http_://_domain/dir1/appA.nsf and http_://_domain/dir2/appB.nsf. Sure, you can write a custom "You clicked on a bad link" for each of these apps using special forms etc, but if you hit http_://_domain/dir1 or /dir2 directly you get back crap.

    At least if you're using the replicaID, you can step back from http_://_domain/repID back to the http_://_domain and not run into any problems (using subdomains for your apps/sites/whatever etc. understood).

    -Chris

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Wed 14 Jan 2004

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content