Db.search, dates and type missmatch

Hi all,

I’m currently in last phase before going berserk over not finding the problem of my db search query.

Here is the code:

Dim dateOutdated As New NotesDateTime("")

Call dateOutdated.Setnow

Call dateOutdated.AdjustDay(-2)



' search db with date limitation!

' THIS DOESNT WORK. if print searchFormula, i get empty string.

searchFormula$ = {Form = "AllNodes" & ([NodeUpdatedDate] < "} & dateOutdated.Dateonly & {" or NodeDaysSinceLastAccess > 1)}



' THIS DOESN'T WORK EITHER. says "type missmatch"

' dateOutdated defined as DateTime

' NodeUpdatedDate is field type "Date/Time"

searchFormula$ = {Form = "AllNodes" & ([NodeUpdatedDate] < "} & dateOutdated & {" or NodeDaysSinceLastAccess > 1)}

I tried next things too:

  • CDat(dateOutdated) - type missmatch

  • Format(dateOutdated, “General Time”) - blank search string

  • dateOutdated.DateOnly - no results (should find at least 2 documents)

  • dateOutdate.ZoneTime - no results

  • using quotes on time or not doesnt help either.

BUT, if i do only:

searchFormula$ = {Form = “AllNodes” & NodeDaysSinceLastAccess > 1}

OR

'searchFormula$ = {Form = “AllNodes” & NodeUpdatedDate < [} & dateOutdated.Zonetime & {]}

both work. i just want to merge those two search strings into one?

can someone please help me out here… i’m really losing my mind. Thank you!

Subject: two searches, merge collections

It looks like you want documents that are EITHER:

Form = “AllNodes” & NodeDaysSinceLastAccess > 1

OR

Form = “AllNodes” & NodeUpdatedDate < dateOutdated.Zonetime

The results of a search are a documentcollection. You can do both searches and then merge the document collections.

call notesdocumentcollection.merge(otherdocumentcollection).

See the designer help “merge method”. It has a very similar scenario.

Subject: thank you

Exactly what I needed! Thank you very much Maria!

Best regards,

Gregor