Solved

Switch/case instead of If

Posted on 2004-09-21
8
240 Views
Last Modified: 2013-12-18
This question is based on Q_21139033

Let's say I have 6 different "date/time" fields.

Some of them could be left blank.

In a view, I'd like a specific column to show the earliest date among the 6 fields...

So, is there a way to do a Switch/case thing in Lotus Notes??  Or should I make a big IF statement?
0
Comment
Question by:barbotte
8 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 100 total points
ID: 12114500
maxy:= @adjust(@Today; 100;0;0;0;0;0);

mindate:= @subset(
    @sort(
        @if(@istime(field1); field1; maxy):
        @if(@istime(field2); field2; maxy):
        @if(@istime(field3); field3; maxy):
        @if(@istime(field4); field4; maxy):
        @if(@istime(field5); field5; maxy):
        @if(@istime(field6); field6; maxy)
    ); 1);

mindate

Unfortunately, works only in R6...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12114531
But don't EVER do this in a view column, for it will make the view unnecessarily slow. It's better to add a field that does this computation when the document is saved.
0
 

Author Comment

by:barbotte
ID: 12114612
sjef_bosman , What does the first line mean?

Cos the dates in the 6 fields could be in 2008 or so!
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:barbotte
ID: 12114646
and...  What should I do if the database already have records in it?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 12114658
Use @Sort if you are using R6

eg:

list := @trim(f1:f2:f3:f4:f5:f6);
Sort(list; [Descending])

~Hemanth
0
 

Author Comment

by:barbotte
ID: 12114906
Ok, sjef_bosman  solution works fine, thank you!
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12116915
You CAN get OK performance out of the @Today by using an odl textttime of "Today" trick.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12120548
The first line creates a vraiable with a date 100 years from now, assuming you're not going over it. Astronomers do...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question