Topic: Direct table access based on parameter Posted: 11 Apr 2012 at 2:37pm
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}
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Posted: 13 Apr 2012 at 8:01am
you could try to use a sub-reports like one sub-report contains {CONSOLIDATED_DAILY_USAGE.USAGE} the other one {CONSOLIDATED_DAILY_USAGE_AR.USAGE} then put a suppression formula in each of them.
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