Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: to choose a DB source from parameters Post Reply Post New Topic
Author Message
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Topic: to choose a DB source from parameters
     Posted: 09 Jul 2009 at 4:44pm
Hi All,
 
is it possible for CR XI to select a database source based on a report parameter?  I have one report that serves two different libraries, both on a same server.  I have two parameters: lib1, lib2. So when user select lib1, I wish the report will point to DB sourceX; if user select lib2, the report will point to DB sourceY.  could anyone please advise if this is  achievable?
Thanks in advance.
 
John
IP IP Logged
AdamField
Groupie
Groupie


Joined: 04 Jun 2009
Online Status: Offline
Posts: 88
Quote AdamField Replybullet Posted: 10 Jul 2009 at 6:05am
Hey Johnwsun,
 
What you could do is make a IF THEN ELSE with the parameter field in for every formula field u use
 
IF parameter = lib1  then lib1.field  ELSE lib2.field
If there from the same db source this will work
 
IF it's from diferent sources it will be more difficult as you still need to link them in database expert.
I never got somthing like that working and i realy tried ..
 
Hope this helps a bit
 
Adam
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Jul 2009 at 6:06am
No, I don't think you can do that.  Think of what you need to do to change the datasource...
 
Well, I'll take a step back, it depends on how the data is delivered to the report.  If you have separate users and you bind to the data via odbc, you could set each user's odbc connection to a different datasource.  If you have 1 user, they would need to change the odbc setting.  If you pass the datasource to the report (ADO.net, XML file) then you control the datasource and not Crystal.
 
But if you want to pass a parameter to change the datasource, the answer, I am fairly sure, is NO.
 
As stated above, there are ways around this.
 
HTH
IP IP Logged
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