[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1015
  • Last Modified:

Crystal Reports - Replace certain text from database

We are using Crystal Reports 8.  We have a report already created, but the person who will be using it wants a date field of a record in the report changed if the time for that record is 11pm.

Source of the data is an SQL database that we cannot edit.  I need to know where I can put in an "If/Then" so that when a record's time is 11pm, for it to display the date of that record -1 day.  For Example, the record in the database would have the following:

wc_schedule_part_tool_view.time_schd = 11pm
wc_schedule_part_tool_view.date_schd = 08/04/04

We want it to then display this record as:

wc_schedule_part_tool_view.time_schd = 11pm
wc_schedule_part_tool_view.date_schd = 08/03/04

Thanks.
0
Luniz2k1
Asked:
Luniz2k1
  • 2
1 Solution
 
frodomanCommented:
What you need to do is instead of displaying the wc_schedule_part_tool_view.date_schd field, create a formula that will output the display.  Your formula would be this:

if hour({wc_schedule_part_tool_view.time_schd}) = 23 then
   DateAdd('d',-1,{wc_schedule_part_tool_view.date_schd })
else
   {wc_schedule_part_tool_view.date_schd}

Use the formula instead of the date field and you're all set.

frodoman
0
 
Luniz2k1Author Commented:
Perfect.  Thank you very much.
0
 
frodomanCommented:
Glad I could help - frodoman
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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