Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: How to reset a DateTime Variable. Post Reply Post New Topic
Author Message
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet Topic: How to reset a DateTime Variable.
    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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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?
IP IP Logged
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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)?
IP IP Logged
andrewsimon
Newbie
Newbie
Avatar

Joined: 28 Jun 2011
Online Status: Offline
Posts: 26
Quote andrewsimon Replybullet 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
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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?

IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 08 Aug 2011 at 3:39am
I have used CDate(0,0,0) to reset dates to  a null date
IP IP Logged
lolly54
Groupie
Groupie
Avatar

Joined: 25 Sep 2011
Online Status: Offline
Posts: 58
Quote lolly54 Replybullet Posted: 17 Jan 2014 at 4:23am
Thanks yggdrasil!
This post  has helped my report :)
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.