Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Datasource Location appears to fail but in fact succeeds 2

Status
Not open for further replies.

Madawc

Programmer
Sep 5, 2002
7,628
0
0
GB
Recently I took a copy of an existing Crystal 11.5 report and tried to use ‘Set Datasource Location’ to move it from one table to another within the same database, e.g. from WIB01 to WIB01ALT, each having much the same fields.

The process seemed to have failed: it accepted ‘Update’ but still showed WIB01. But when I ran it, I found it had picked up the WIB01ALT data. Checking the SQL, I found it was in part
Code:
 FROM   ("TAR"."dbo"."CurrentMonth" "CurrentMonth" INNER JOIN "TAR"."dbo"."WIB01ALT" "WIB01"
It was using the original table name as an alias. The fields continue to appear with the WIB01 table name, which is also used in the Field Explorer.

If I hadn’t tried running the report on the off-chance, I would have wasted some time needlessly re-creating the report from scratch. That’s why I have posted it as a tip. But it anyone understands why it works this way, I’d appreciate their input.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Hi,
As I understand it ( no guarantee of accuracy [wink] )CR will retain the original table name in most cases since there may be formulas, selection criteria, etc. within the report that use that table name and changing it would require you to rewrite all those items. By aliasing the original name all those internal uses will still work.





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
What CR is doing is retaining the original alias of the table. If you want you can also update the alias of this table to show the new table name (or any other name). Go into the database expert and highlight that table on the right side. Now hit F2 and you can change the table name to what ever you want. This will change the alias used in the SQL. I have seen some rare cases where the alias change will cause the SQL to error but this works fine in 99% of cases.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Thanks, kenhamady

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top