|
Hi all,
I am new here. Now I have a very urgent question. I have two tables, Usage and Usage_Archive table. Usage table stores the recent 12 months usage data, and Usage_Archive table stores the usage data older than 12 months.
I want to dynamically decide which table to access according to the date parameter that the user entered. If the date user entered is within last 12 months, the crystal report will access the Usage table. Otherwise if the date is older than last 12 months, the report will access the Usage_Archive table. I used either formula or variable with a condition, but neither of them worked. It brought back wrong data set. I checked the query statement of the report, Usage and Usage_Archive tables were joined together, that brought more data than expected. The following is the formula that I defined:
if datediff("m", {?Date},currentdate)<=13
then {CONSOLIDATED_DAILY_USAGE.USAGE}
else {CONSOLIDATED_DAILY_USAGE_AR.USAGE}
I am using Crystal Report 2008.
Could anyone help me out? Thank you very much!
Edited by pare169 - 11 Apr 2012 at 2:46pm
|