Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

will Crystal process this formula differently?

Status
Not open for further replies.

yehong

Programmer
Sep 22, 2003
291
US
i have two formulas, purpose is same but difference in order of selection:
//formula1
{?EvalDate} >= {OBJ.EFFDATE} and
{?EvalDate} < {OBJ.ENDDATE}

//formula2
{OBJ.EFFDATE} <= {?EvalDate}and
{OBJ.ENDDATE} > {?EvalDate}

Will both formulas return same results? I have tried both formulas and checked the SQL Query and crystal creates it like this for both formulas: And, also I don't know why &quot;=&quot; sign does not appear in the query?
WHERE
OBJ.&quot;EFFDATE&quot; < {ts '2005-01-02 00:00:00.00'} AND
OBJ.&quot;ENDDATE&quot; > {ts '2005-01-01 23:59:59.00'}

Thanks.
 
To answer your 2nd question first, chances are you entered 1/1/2005 and your {?EvalDate} parameter. Notice what Crystal did: it changed the date to 1/2/2005 and used a &quot;less than&quot; sign. Crystal is attempting to take into account the fact that your EFFDATE and ENDDATE fields are of data type datetime. In the case of the first comparison, it's advancing to the first second of the next day and then filtering on datetimes less than that moment in time. In the case of the second comparison, it's saying that the field must be greater than the last second of the day on 1/1/2005.

As for the first part of your question, I don't see why these two statements wouldn't evaluate the same. Are you experiencing different results based on which of these two formulas you are using?
 
I appreciate your response.
I am getting the same results with both formulas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top