A Better Solution , Inc. - FAQ Answer

View A Better Solution, Inc. Virtual Business Card.

How do I find information that was created "on" a date or "between" two dates (i.e. all versions on Jan. 1st or between Jan. 1st and Jan. 7th)?

This is often asked because ClearCase offers a "created_since" option on cleartool find, but no "created_before" or "created_on" options. I don't know why these options don't exists (it would make some queries easier), but they can be simulated without too much difficulty.

The best way for me to advise on this is to just go to the examples...
  1. Find all elements created between Jan. 1st and Jan 7th
    Example #1.

  2. Find all elements created on Jan. 1st
    Example #2.


Solution #1: Find all elements created between Jan. 1st and Jan 7th

The Key: Don't think you will build a query that has "created_since" time A and "created_before" time B (even though that is what you want). Think instead of "created_since" time A and "not_created_since" time B.

In English: Substitute in your mind "created_before" (which does not exists) with "!created_since" (which does exists) when making queries.

ASSUMING: When I say between Jan 1st and Jan 7th I mean 12:00:00am on Jan 1st to 11:59:59pm on Jan 7th inclusive.

cleartool find . -all -element "created_since(01-Jan-2002) && !created_since(08-Jan-2002)" -print

NOTE: When the "time" is not given it assumes the first second of the day so "since the 1st" includes all of the first while "not since the 8th" means everything before the start of the 8th or up to the end of the 7th.


Solution #2: Find all elements created on Jan. 1st

The Key: Remember that "on a day" is really just between two points of time "start-of-day" and "end-of-day"... Then it is just like the previous example

ASSUMING: When I say on Jan 1st I mean 12:00:00am on Jan 1st to 11:59:59pm on Jan 1st inclusive.

cleartool find . -all -element "created_since(01-Jan-2002) && !created_since(02-Jan-2002)" -print



Net-net on all of these examples (and other interpretations) is .... "it can be done... and it is easy, once you know how"..

Hope this helps...
Back to FAQ


Copyright 2015 A Better Solution, Inc.