I have two fields. Field1 is a text field with type computed and Field2 is date type. I have written an agent where
I have to subtract these two fields. When I do this I get a error message saying "Type MisMatch." Can you please tell me why this is happening and what the remedy may be? Dates are the hardest thing for me to work with. I usually end up doing a lot of stuff I probably don't have to when I start manipulating dates. So, if someone reads this and thinks, "Why is he doing that?" it's just from past experience, and I'm covering all my bases.
Let's say we have two fields, Field1 and Field2 (as in your problem). I'll compute Field1 to "07/24/2002 12:00:00 PM". I'll put in Field2 [07/21/2002 08:34 AM] as a Date/Time field value.
I'll put five more fields below the button (which I labeled "equals"):
- Field3 shows the number of total seconds between the two dates.
- Field4 shows the number of days (within Field3)
- Field5 shows the number of hours
- Field6 shows the number of minutes
- Field7 shows the number of seconds
So, in my example above, I would get 185161 seconds between the two times, which is:
2 Days 3 Hours 26 Minutes 0 Seconds
I'm going to do this in @Function and LotusScript, since you didn't mention which type of agent you were using. First the @Function:
NumDiffSeconds := @TextToTime(Field1) - Field2;
NumDays := NumDiffSeconds / 86400;
NumPartialDays := NumDays - @Integer(NumDays);
NumHours := NumPartialDays * 24;
NumPartialHours := NumHours - @Integer(NumHours);
NumMinutes := NumPartialHours * 60;
NumPartialMinutes := NumMinutes - @Integer(NumMinutes);
NumSeconds := NumPartialMinutes * 60;
FIELD Field3 := NumDiffSeconds;
FIELD Field4 := @Integer(NumDays);
FIELD Field5 := @Integer(NumHours);
FIELD Field6 := @Integer(NumMinutes);
FIELD Field7 := @Integer(NumSeconds);
Dig deeper on Domino Resources - Part 2
Related Q&A from Todd Fuder
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.