Solved

Comparing fields of DATE/Time type

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

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!

Question has a verified solution.

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

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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