Solved

Switch/case instead of If

Posted on 2004-09-21
8
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.5 1 163
lotus domino server console error 1 86
How to auto purge mail to keep latest one month mail of a replica? 4 105
Lotus Notes transfer mail box problem 6 109
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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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