Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Direct table access based on parameter Post Reply Post New Topic
Author Message
pare169
Newbie
Newbie


Joined: 11 Apr 2012
Location: Australia
Online Status: Offline
Posts: 1
Quote pare169 Replybullet 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}

I am using Crystal Report 2008.

Could anyone help me out? Thank you very much!


Edited by pare169 - 11 Apr 2012 at 2:46pm
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
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



This page was generated in 0.016 seconds.