Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Field Population based on Date Created

Field Population based on Date Created


I have a need to populate a field in a Crystal Report (using SAP Crystal Reports 13)

The Population of the field will depend on the following Criteria

If the Day of running the report is a Monday and the {Create_Date} is in the last 72 hours then tag the field as NEW
If the Day of running the report is any other day and the {Create_Date} is in the last 24 hours then tag the field as NEW
Any records whose {Create_Date} falls outside the above then tag the field as EXISTING

I have used this formula before to look back different times based on the Day of the week, but im a little lost what needs to be done to achieve the above

if dayofweek(currentdate) = 2 then
{BMCServiceDesk__Problem__c.BMCServiceDesk__Closed_Date_Time__c} in dateadd("h",-72, datetime(currentdate,time(11,0,0))) to datetime(currentdate,time(13,0,0))
{BMCServiceDesk__Problem__c.BMCServiceDesk__Closed_Date_Time__c} in dateadd("h",-24, datetime(currentdate,time(11,0,0))) to datetime(currentdate,time(13,0,0))

Very grateful if anyone can nudge me in the right direction


RE: Field Population based on Date Created

I would have used the datediff function. I am not sure if the {BMCServiceDesk__Problem__c.BMCServiceDesk__Closed_Date_Time__c} is the {Create_Date} or that is another field.

if dayofweek(currentdate) = 2 then
if datediff('h',{Create_Date}, currentdate) <= 72 then 'NEW'
if datediff('h',{Create_Date}, currentdate <= 24 then 'NEW"

RE: Field Population based on Date Created

Thanks. Thats Perfect. Cheers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close