Date Value List Problem

I need to compare two date list. I am using following code :

@Keywords(@Text(CalendarDateTime;“D0S0”); @Text(@Explode([06/26/2008 - 06/30/2008])))

CalendarDateTime => is a field in Calendar document.

I am not sure, but this is very much depend on Local machine Date Format.

If system date format is dd/mm/yyyy ( / is separator) then it works fine. But when I change format to dd.mm.yyyy (. is separator) thenI am getting resultant list as blank.

What is the problem in this. What can be other way on this?

Subject: RE: Date Value List Problem

First, I think your problem might have to do with the @Keywords function and what it considers a word delimiter.

But, that’s a side issue. It’s not generally a good idea to convert dates to text to compare them, and it’s not necessary. Dates can equally well be compared without conversion to text. In this case, to see whether a date is a member of a list of dates, you can just use =, e.g.:

@Date(CalendarDateTime) = @Explode([06/26/2008 - 06/30/2008])

I use @Date here to get rid of the time component of CalendarDateTime.

In this case, your list of dates happens to be a range, so you don’t need to use the expensive @Explode function to generate the list. You can just write:

CalendarDateTime >= [06/26/2008] & CalendarDateTime <= [06/30/2008]

For most formulas, you can just put a constant date in brackets and not worry about it, because the formula is “compiled” and this date is stored in a locale-independent way. However, if your formula is not compiled at design time (e.g. if it’s a string constant in a LotusScript agent) then you need to write dates in a way that doesn’t depend on the locale, e.g. @Date(2008; 6; 26)

Subject: RE: Date Value List Problem

Hello Andre,Thanks for reply…

Thing is CalendarDateTime is multivalued field. And if I use only @date function it gives me only first date. not the entire list.

The case is I was want to compare two date lists. one is CalendarDateTime Field (multivalued.) and date range given by user.

Subject: RE: Date Value List Problem

…CalendarDateTime is multivalued field. And if I use only @date function it gives me only first date. not the entire list.No, I’m very sure that @Date will return a list if you give it a list argument. Nearly all macro functions work that way. Though when comparing a date/time to a date-only value, I’m not sure it matters; I think the time might be disregarded anyway in that case.

want to compare two date lists. one is CalendarDateTime Field (multivalued.) and date range given by user.

And determine what exactly? Whether all the dates are within that range? Whether one or more are in the range? Whether all are outside the range?

Your use of @Keywords suggests you want to find the subset of dates that are within the given range. For this, you might use a loop, e.g.:

matches := @Transform(CalendarDateTime; “x”; @If(x >= StartDate & x <= EndDate; x; @Nothing));

@If(@Elements(matches) > 0; …