Print Page | Close Window

How to reset a DateTime Variable.

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13925
Printed Date: 02 May 2024 at 9:01am


Topic: How to reset a DateTime Variable.
Posted By: andrewsimon
Subject: How to reset a DateTime Variable.
Date Posted: 31 Jul 2011 at 2:15am
Dear all,
 
I want to reset a datetime variable on the groupheader.
I tried tis formula to reset the DateTime Variable;
 
WhilePrinting Records;
DateTimeVar lastout := DateTime(1900,1,1,0,0,0);
 
But the dateTime variable is not resetting,
Any help will be appreciated....


-------------
bbbbb



Replies:
Posted By: DBlank
Date Posted: 01 Aug 2011 at 8:28am
looks fine other than WhilePrinting Records should be WhilePrintingRecords (all one word).
Did you place this in the group header?


Posted By: andrewsimon
Date Posted: 01 Aug 2011 at 8:04pm
Thank u DBblank.
i tried ,in that way what u said..but it seems that the varible is not resetting.
I found in the net that,there is no default value for datetime,
like for
Numbervar x :=0;
Stringvar h := " ";
 
so iwant to know how to reset a datetime varible using the default value.


-------------
bbbbb


Posted By: DBlank
Date Posted: 02 Aug 2011 at 3:49am
can you explain what you need the default value for? What is the variable trying to do in the report (other than your reset)?


Posted By: andrewsimon
Date Posted: 02 Aug 2011 at 9:15pm
Thank You DBlank. I will explain to you the full scenario,what i wish to achieve.
I am trying to find out the lunch out of each employee per day.
so i want to reset the lunchout(datetime) variable for each employee per day.
The same concept is applicable to getin(datetime) variable also.
my report is grouped by department,empid,date.
 
This is the formula  i'm using for getting lunchout,
 
if ((ShiftDateTime({EVENTS.EVENT_TIME_UTC},"UTC,0","") IN  PlannedTime1 TO PlannedTime2) AND ({READER.TIMEATT} =2))
then
 
 DateTimevar lunchout := ShiftDateTime({EVENTS.EVENT_TIME_UTC},"UTC,0","");
lunchout;
 
And for restting i;m using the following formula,
WhilePrintingRecords;
DateTimeVar lunchout := DateTime(1900,1,1,0,0,0);
 
 
 


-------------
bbbbb


Posted By: DBlank
Date Posted: 04 Aug 2011 at 4:31am

in the structure is it one row per datetime event that you need to compare to the next row and you are using some other way to tell if it was a clock for lunch rather than just out for the day?



Posted By: yggdrasil
Date Posted: 08 Aug 2011 at 3:39am
I have used CDate(0,0,0) to reset dates to  a null date


Posted By: lolly54
Date Posted: 17 Jan 2014 at 4:23am
Thanks http://www.crystalreportsbook.com/Forum/member_profile.asp?PF=1751&FID=7 - yggdrasil !
This post  has helped my report :)



Print Page | Close Window