Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Comparing fields of DATE/Time type

Posted on 2003-10-24
8
Medium Priority
?
222 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 80 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

721 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