logo

LotusScript for Colour-Coding "Views"

hot If you look at the DEXT homepage (there's a perma-link to it on the tabs above!) and scroll to about half way down you should see something like the image to the right.

This is the LotusScript alternative to the view-based method of colour-coding document, based on their age, which I talked about last week.

The view-based method has numerous shortcomings, which this LotusScript version avoids. Not only that but the LS version is accurate to the second, whereas the view version is only accurate to the day!

The demo I cooked up for this version works the other way round to last week's demo. Now we're making new (hence "hot") documents red and older ones white.

The trouble with the whole approach is that there's no one-size-fits-all solution I can code. How you use the concept depends entirely on the scenario you'll use it in.

For now I'll leave you with the demo as I don't have time to discuss the ported code. You'll see the code if you download the DEXT app after I've made a new version available tomorrow.

One thing I will say about the code is that it produces CSS values such as rgb(255,977,977) which is of course wrong, but I can't see an equivalent of @Min() in LotusScript, so I've left it as is. The browsers don't seem to mind accepting the value of white. It's Daz white in fact (a joke for the Brits there!).

Comments

  1. >> no equivalent in LotusScript

    Then use Evaluate (if appropriate).

    • avatar
    • Kerr
    • Wed 3 Dec 2008 06:21 AM

    Now now Jake, surly it's not beyond you to right your own Min function?

    ;)

    --

    Kerr

    • avatar
    • Jake Howlett
    • Wed 3 Dec 2008 07:11 AM

    Both using Evaluate and writing my own if-then-else "function" crossed my mind, but I wanted to keep it as pure as possible. It just seems wrong to over-complicate the code for such a trivial thing and using evaluate is always a last resort for me.

    By leaving it as it is it's my own little protest against the lack of a Min() function. Why isn't there one?

    • avatar
    • andy
    • Wed 3 Dec 2008 07:17 AM

    Mybe @min was provided in formula at a time when it couldn't perform iterative statements, where as Lotusscript could, so it seemed a trivial excercise to include it.

    just a thought.

    • avatar
    • Jake Howlett
    • Wed 3 Dec 2008 07:33 AM

    Ok, I gave in and added an extra line:

    if percent_red>255 then percent_red=255

    I know what you're thinking - "What was all the fuss about? It's only one extra line!". I'm wondering the same too. I'm such a dufus sometimes.

    • avatar
    • Andrew Culbert
    • Thu 4 Dec 2008 07:07 AM

    Hope you don't mind the question, but why is Evaluate the last resort for you? It's quicker than sh1te off a shovel; and even if it isn't the most elegant solution, you can pretty much assume that if a future developer can read script, they understand formula language too?

    • avatar
    • Jake Howlett
    • Thu 4 Dec 2008 07:18 AM

    Don't mind the question at all Andrew. I just don't know if I can answer it to your satisfaction. The only answer is that I'm weird like that. I do use Evaluate. All the time. It just felt wrong on this occasion. See what I mean, weird.

  2. It would have been wrong -- icky, even -- in this case. @Min would have involved either building an array (which could either use the Formula engine's inefficient list literal method or a call to an extra function, @Explode) or passing a document handle, in addition to the overhead of calling an external library (even if the engine is in memory, you'd still need to locate the function pointer, etc.). Let's face it, we're not talking about @DbColumn here.

Your Comments

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


About This Page

Written by Jake Howlett on Wed 3 Dec 2008

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