Solved

Switch/case instead of If

Posted on 2004-09-21
8
239 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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