Joined: 19 Sep 2008
Location: United States
Online Status: Offline
Posts: 7
Topic: Use of If Then Statement to Select Table Posted: 12 Jul 2012 at 11:39am
I am composing a report in Crystal Reports 9 in which I need to access and display data (due dates for multiple projects) that may be in one of two tables, depending on the type of project. I am picking a calendar date range via Crystal, then attempting to get all the due dates for a series of project within that date range. In order to make this work I need to tell Crystal to check the media code for the project, and depending on the type of media, go to the correct table to find the corresponding due dates for that project.
Most of my reports are simple ones, and I have no problem if I run separate due date reports for each of the two project types. However, I would like to include the due dates for both types of projects in a single report, and this is the first time I've tried to incorporate an if then statement in a report. Is the formula I wrote below on the right track to get me a functioning report?
If {ad_info.media_cd} = "ROP" Then {vrsn.prdctn_schdl.job_step_due_dt} Else If {ad_info.media_cd} <> "ROP" Then {ad_prdctn_schdl.job_step_due_dt}
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 13 Jul 2012 at 4:41am
This should work. However, if you can make changes in the database, I would try creating a View that combines the two tables in a UNION query. Then, instead of joining to two separate tables, your report could join to just the one view and you wouldn't have to create all of these formulas.-Dell
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum