Solved

Comparing fields of DATE/Time type

Posted on 2003-10-24
8
216 Views
Last Modified: 2013-12-18
Hi all,

I would like any one to help me. i have a form with 2 date/time fields. i want to compare them ( > / < / = ) and produce some outputs.

so if say (field A > field B) then do this, if (A < B) then something else if both r equal then do this

U all r my trainers.
Pl help,
Thx
bama
0
Comment
Question by:bamar123
8 Comments
 
LVL 15

Expert Comment

by:Bozzie4
Comment Utility
let's say they are called fieldA and fieldB, and put this in a computed field for testing

@if( fieldA > fieldB; "THIS" ; fieldA < fieldB; "THAT" ; "EQUAL" )

cheers,

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
Bozzie,

technically, that shoulhd beL

FIELD outputs := @if( fieldA > fieldB; "DO THIS" ; fieldA < fieldB; "SOMETHING ELSE" ; "R EQUAL - DO THIS" )


:)
0
 

Author Comment

by:bamar123
Comment Utility
thx,
But am looking for LotusScript. i was able to do it but when i used that in a agent which moved all files newer than the input Date in a particuler database file, it gives an error of Object variable not defined.

thx,
bama
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
I don't know why you would have any problem is LotusScript...

Dim doc as notesDocument
Set doc = .... 'maybe this is in a loop, maybe it is notesSession.documentContenxt or noteUiDocument.document
Dim fieldA, fieldB
fieldA = doc.fieldA(0)
fieldB = doc.fieldB(0)
If fieldA > fieldB Then
  ...
ElseIf fieldA < fieldB Then
  ...
Else
  ...
End If

The only thing you might want to watch out for is if either or both fields contain blank values.

I don't really like the way you posed the question though.  If you had existing code that you needed debugged, why didn't you say so?  If it was LotusScritp you wanted, why didn't you say so?  This wastes my time and yours.
0
 

Accepted Solution

by:
ecantu earned 20 total points
Comment Utility
I solve it using the Cdbl() function in LotusScript to get a numeric value from the date value, like:

DateTimeField1 = 10/10/2003
DateTimeField1 = 10/13/2003

val1 = Cdbl(DateTimefield1(0))
val2 = Cdbl(DateTimefield2(0))

' Diference between dates In days

val3 = val2 - val1
val3 = 3

' OR:
' compare dates

if val1 > val2 then
   ....
else
   ....
end if



hope this help! :p
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now