• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Crystal Reports - Record Selection for Last YTD with TIME

Hello Experts,

Can you show me how to include the TIME in a the record selection where I want to include records: {IIncident.I_tTimeTransmit} in LastYearYTD  using the CurrentDateTime to identify the TIME part ?

Thank you.
~Chopp
0
Chopp
Asked:
Chopp
  • 2
  • 2
2 Solutions
 
mlmccCommented:
Try  this

{IIncident.I_tTimeTransmit} >= Date(Year(CurrentDate),1,1)
AND
{IIncident.I_tTimeTransmit} <= DateAdd('yyyy',-1,CurrentDateTime)

mlmcc
0
 
ChoppAuthor Commented:
Hi mlmcc,

That idea returned zero records.

~Chopp
0
 
James0628Commented:
LastYearYTD gives you a range of dates.  I assume that you only want to add the time to the ending date?

 This should work:

{IIncident.I_tTimeTransmit} in Minimum (LastYearYTD) to
 DateTime (Maximum (LastYearYTD), CurrentTime)

 There are other ways that you could handle it, including a formula like the one that mlmcc posted.  I just decided to use the LastYearYTD function that you were already using.


 FWIW, I think the problem with mlmcc's formula is that he didn't subtract 1 from the starting year.  If I'm right, his formula should work if you change the first line to:

{IIncident.I_tTimeTransmit} >= Date(Year(CurrentDate) - 1,1,1)


 James
0
 
mlmccCommented:
My formula should have been

{IIncident.I_tTimeTransmit} >= Date(Year(CurrentDate) - 1,1,1)
AND
{IIncident.I_tTimeTransmit} <= DateAdd('yyyy',-1,CurrentDateTime)

Open in new window


mlmcc
0
 
ChoppAuthor Commented:
mlmcc and James, Thank you so much!  Both of your ideas work perfectly for my report.
mlmcc, can you explain the pieces of your method so I can understand it better ?

Have a splendid day.
~Chopp
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now