|
|
Question : 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.
|
Answer : Crystal Reports - Replace certain text from database
|
|
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
|
|
|
|
|