• Status: Solved
• Priority: Medium
• Security: Public
• Views: 428

# 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
• 2
• 2
2 Solutions

Commented:
Try  this

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

mlmcc
0

Author Commented:
Hi mlmcc,

That idea returned zero records.

~Chopp
0

Commented:
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

Commented:
My formula should have been

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

mlmcc
0

Author 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.