Solved

Comparing fields of DATE/Time type

Posted on 2003-10-24
8
217 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
ID: 9614174
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
ID: 9614330
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
ID: 9619132
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
ID: 9621359
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
ID: 9638813
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why won't this building block macro run? 6 285
Lotus Notes: Email Delivery Failure 5 160
NT Kernel & System Process CPU Usage Maxin out 8 50
lotus notes, exchange 7 109
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

23 Experts available now in Live!

Get 1:1 Help Now