Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Splitting datetime field Post Reply Post New Topic
<< Prev Page  of 2
Author Message
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Sep 2012 at 2:35am
I do want it to always be the current week. Here is the statment I am using in the select statement but I get different results than if I enter the actual dates.
 
CurrentDate in {VP_SCHEDULE.CURRPAYPERIODSTART} to {VP_SCHEDULE.CURRPAYPERIODEND}
 
 
Thanks
KevV
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2012 at 7:31am
you would get different resyults only if there are variations in the data hat allow one row to be included in one statemetn but exclude in the other statement (e.g. do some rows have a different end date)?
what exactly do you want to pull in?
records that have a start date int he last 14 days?
Records where the start and end date are exactly last monday and last saturday?
records where the end date is more than 7 days ago?
 
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Sep 2012 at 9:40am
I checked all the rows in the table and they all have the same start date and end date so I am not sure why the results are different. I thought maybe there was something wrong with my statment. What I am looking for is to show the current week from Sunday thru Saturday.
 
Thanks
KevV
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2012 at 9:44am

odd.

CurrentDate in {VP_SCHEDULE.CURRPAYPERIODSTART} to {VP_SCHEDULE.CURRPAYPERIODEND}
 
should be fine
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Sep 2012 at 10:39am
I think I see the issue, In the table there is {VP_SCHEDULE.CURRPAYPERIODSTART} and {VP_SCHEDULE.CURRPAYPERIODEND} and they all show the same start and end date but in another column is the {shiftstartdate} and {Shiftenddate}and it list all times since we installed the system. So the table shows:
 
 
       {shiftstartdate}             {Shiftenddate}                 {shiftstartime}
 
{9/17/2008 9:00:00 AM} {9/17/2008 2:00:00 PM} {1/1/1900 9:00:00 AM} 
 
 
 
  {Shiftendtime}           {CURRPAYPERIODSTART} {CURRPAYPERIODEND}
 
{1/1/1900 2:00:00PM}         {9/16/2012}                 {9/22/2012}
 
 
 
 
{PREVPAYPERIODSTART} {PREVPAYPERIODEND}
 
{9/9/2012}                         {9/15/2012}
 
So I pulled all recods that have a shift start date and shift end date in the current pay period rather than stating that the current date is in the time period and it worked. One last thing Is there a way thet if the time is on the hour it can show just the hour. I tried to format the field but that does not work. I bascially want it to show something like:
 
7AM - 3:30PM.
2:30AM - 10PM
 
and formatting the field only gives me:
 
7:0AM-3:30PM
2:30PM-10:0PM
 
Thanks
KevV


Edited by KevV - 17 Sep 2012 at 10:41am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2012 at 10:48am
i assume you are using some version of totext on the time as posted earlier. just use a replace on it
 
if weekday(table.datefield)=1 then replace(totext(starttime,"h:mmtt"),":00","") + "-" + replace(totext(endtime,"h:mmtt"),":00","")
 
IP IP Logged
KevV
Senior Member
Senior Member


Joined: 19 May 2011
Online Status: Offline
Posts: 106
Quote KevV Replybullet Posted: 17 Sep 2012 at 12:22pm
That did it You are Awesome.
 
Thanks
KevV
IP IP Logged
<< Prev Page  of 2
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.