Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Population based on Date Created

Status
Not open for further replies.

keenoafc

IS-IT--Management
Apr 9, 2013
7
GB
Hi

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))
else
{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

Thanks
 
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'
else 'EXISTING'
else
if datediff('h',{Create_Date}, currentdate <= 24 then 'NEW"​
else 'EXISTING'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top