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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display data source on report 1

Status
Not open for further replies.

dstelow

Programmer
Dec 22, 2004
2
US
Hi all,
Does anyone know how to display the data source info on the report, e.g. server name, db name, etc. I do not see a "Special Field" for this purpose.
Thanks,
dstelow
 
Dear dstelow,

What version of crystal, what database, what driver?

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
With Cr 8.5 with an Oracle DB, I created a subreport and placed it in the Report Header and minimized as small as possible.

The report contains just one table, V_$DATABASE.

I create a formula with a shared variable that I can use within the main report.

//@DBID
shared stringvar DB_Name := {V_$DATABASE.NAME};


Cheers,
-LW
 
What ro is fishing for, is to find out if you're db/connectivity supports SQL Expression Fields. Here's a couple of threads with some ideas:
thread768-934767
thread766-679683

-dave
 
Dear Wichitakid,


You don't have to do that, you can just create a sql expression as follows:

(sys_context ( 'USERENV', 'DB_NAME', 30 ))

To get the machine name ....

(USERenv('TERMINAL'))

To get the WorkGroup and Machine name:

(sys_context ( 'USERENV', 'HOST', 54 ))

The above only applies to Oracle (specifically 8.17 as I haven't tested on other versions). There are different ways to get it for sql server.

Regards,

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Dear Virdu,

You are correct :) ... and the two threads you pointed to have pretty much what I would post for SQL Server.

Regards,
ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
THANK YOU, Rosemary! Definitely a star in my book.

-LW
 
Dear Wichitakid,

By the way, this would work too, using your original stuff in a SQL expression, however you have to run the report as SYS or with sys privileges, whereas the one I posted will run with just db user privileges.

(SELECT "V_$DATABASE"."NAME"
FROM "V_$DATABASE")

Glad that helped you out and thank you for the star.

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Thanks all for the great feedback.
-Dean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top