Print Page | Close Window

Report mapping to specific DB based on Parameter

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16029
Printed Date: 21 Apr 2025 at 1:32pm


Topic: Report mapping to specific DB based on Parameter
Posted By: cwar
Subject: Report mapping to specific DB based on Parameter
Date Posted: 28 Mar 2012 at 8:01am
Hi all,

New to the forum and crystal reports as well, so this question shouldn't be too hard to answer but I've searched and browsed the forum for a bit and haven't found an answer.

I am using an application that defines an ODBC datasource which should be the database that the queries and stored procedures are run against.

I have had issues previously when using Database Expert (or at least I assume it was when I used database expert). It seems that sometimes when I used this feature, the queries would be run instead of "rep_StoredProcedure" it is run as "DB"."rep_StoredProcedure" and thus when I attempt to run the report against DB1 DB2 DB3 etc it would generate the SP query as "DB"."rep_StoredProcedure" and only hit this one DB. To get around this I re-created the report one step at a time, testing each time to see if the query had changed from "rep_StoredProcedure" to "DB"."rep_StoredProcedure". Inconvenient and time consuming, but it was the best I could come up with at the time.

Now I am having a problem with one of these reports that is actually generating the query fine most of the time, except when one specific report setting is set. Then it generates the query mapped to the specific DB.

TL;DR - Need my report to use ODBC connection defined in the application, when one report setting is set from the application it is mapped to a specific DB.

Can anyone point me in the right direction here? It's very confusing to me how these DB mappings are created, especially for just one case.



Replies:
Posted By: lockwelle
Date Posted: 05 Apr 2012 at 5:37am
what I have seen is changing the database that the ODBC connection is pointing to, otherwise you need to change things in the report that cannot be done dynamically.
 
As an alternative, I have used an OLE connection which changed more easily, but the best option, if you can manage it is:
  have an application that gathers the data (it is probably much easier to gather this information correctly) and then 'push' the data to the report. Report doesn't know or care where the data came from.
 
HTH



Print Page | Close Window