| Author |
Message |
JennyB
Newbie
Joined: 26 Dec 2012
Online Status: Offline
Posts: 24
|

Topic: Retrieve Field Alias Descriptions from DB2 Posted: 27 Dec 2012 at 12:31am |
|
Hi :)
I was wondering if there was a way to let Crystal Reports (2008) know the alias for a field name in a table? I've got a lot of reports to convert and I'm using Add Command and it's going to take ages if I have to put SELECT TITL20 AS Title etc in for every field I use. There are descriptions for each field in our iSeries DB2 database, could Crystal read those? If not, is there a way I can name them once somewhere and have it remember? We don't have Crystal Server so that doesn't sound hopeful to me, but it would be nice.. :)
Thanks,
Jenny
|
IP Logged |
|
|
|
shanth
Groupie
Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
|

Posted: 27 Dec 2012 at 9:06am |
|
If you need them as headers in your report: drag n drop the fields and edit text and rename them. If thats not you need, write formula something like: IF Field1= 'TITL20' Then 'Title' Else if Field1= 'XXXX' Then 'yyyy' Else if Field2= 'aaaa' then 'bbbb' ELSE ' '
|
IP Logged |
|
JennyB
Newbie
Joined: 26 Dec 2012
Online Status: Offline
Posts: 24
|

Posted: 27 Dec 2012 at 10:35pm |
|
Hi,
Thanks, thats what I thought I might need to do, I've got a ridiculous work-around now where I've exported the field names and descriptions out of the iSeries and into Excel, I've set up a directory mail merge in Word with the text below and put it all into a macro to find and replace '<newline>LIBRARY.TABLE.FIELD,' with '<newline>LIBRARY.TABLE.FIELD as FIELD_DESCRIPTION,' for every field in every table that might come into my reports. I've copied the SQL from Crystal's Add Command into Word (with all of its smart quotes etc autoformatting turned off) and run the macro over it and pasted it back. There are hundreds of queries I need to convert with too many fields to have done it manually unfortunately. Its a bit of a pest, but it works! :)
With Selection.Find .Text = "^13 «Library».«Table».«Field»,^13" .Replacement.Text = "^13 «Library».«Table».«Field» as «Field_Description»,^13" End With Selection.Find.Execute Replace:=wdReplaceAll «Next Record»
|
IP Logged |
|
|
|