Solved

Comparing fields of DATE/Time type

Posted on 2003-10-24
8
218 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

803 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