Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using data from two databases Post Reply Post New Topic
Author Message
wimvtuijl
Newbie
Newbie


Joined: 09 Feb 2009
Location: Netherlands
Online Status: Offline
Posts: 2
Quote wimvtuijl Replybullet Topic: Using data from two databases
     Posted: 09 Feb 2009 at 8:38am
Hi all, im new to this forum and I hope you can help me out. I am using CR 11 for a few months now and untill now I was able to figure things out myself (with a little help from this forum Wink), but now i am stuck:

I want to make a report which derives data from two databases. One of them contains all our tickets (changes and incidents), all those tickets are linked to a productionnumber. The other database contains all the costs and benefits for each productionnumber.

My goal is to make a report with all changes that are still open from the first database and get a column with the sum of all costs and a column with the sum of all benefits from the second database. (based on the productionnumber)

So I want to link both databases with this productionnumber. But the format of the productionnumber isnt the same. It's text (9951004) in the one and a number in the other one (9.951.004,00). That's why I can't link them.

I tried to convert the format of one of those fields and inserted the outcome in a new column, but Im still not able to link the databases (I allready thought it would be too easy this way Wink). Now I would like to know if this is possible at all.

I allready read a few things about shared variables, which is totally new to me. I think I am supposed to use them, but I can't figure out how.

I hope anyone can help me out or at least gives me a startingpoint. If you need any more info, i will be happy to give it...


Edited by wimvtuijl - 09 Feb 2009 at 8:40am
IP IP Logged
despec99
Newbie
Newbie


Joined: 10 Feb 2009
Online Status: Offline
Posts: 22
Quote despec99 Replybullet Posted: 10 Feb 2009 at 6:05am
Actuallly, the best way to handle this kind of situation is to write a SQL command query, instead of using CR table links.  You could write a query for the first table, then write another query on the other table, but convert the production number to the data type that will allow the link.

Another way would be to use a subreport and link using a formula that converts the field in question to the data type of the other table field.

David


Edited by despec99 - 10 Feb 2009 at 10:32am
IP IP Logged
wimvtuijl
Newbie
Newbie


Joined: 09 Feb 2009
Location: Netherlands
Online Status: Offline
Posts: 2
Quote wimvtuijl Replybullet Posted: 13 Feb 2009 at 6:29am
Thanks for your reply Despec!

I tried your 2nd suggestion (linking a subreport with a formula) first and it worked. But that way the report resfreshes both the mainreport and the subreport and there is way too many data in the tables used in my subreport. CR really doesnt like this...

So I figure that your 1st suggestion works better, because that way the report doesnt have to refresh all lines in the 2nd database, but only the lines I need, right?

I'm not quite sure how i should link two databases in a SQL command query. But I will try to figure it out...
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