Print Page | Close Window

How to change a field name in CR

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
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=5511
Printed Date: 06 May 2024 at 7:53am


Topic: How to change a field name in CR
Posted By: StephanieD
Subject: How to change a field name in CR
Date Posted: 13 Feb 2009 at 3:56am
I am a VB programmer by trade, and just started using Crystal Reports within the Visual Studio 2005 development suite.

I am impressed with CR and will be using it a lot more from now on.

I'm not sure if many people her are VB programmers, but I have a Crystal Report that reads data in from a DataView that is created in VB.

One of the field names in the DataView is changing. [IssuedBy] is becoming [IssuedByName].

What I would like to do is click the [IssuedBy] field on my Crystal Report, go to Properties, and find an area where I can make the change to the field name that it expects to find from its data source.

I can't seem to find it though!

Any suggestions?

If I were reading directly from a database, I would browse to it in the database and insert a new copy of the field.

But I can't browse a DataView that I build in code.

Can anyone help?



Replies:
Posted By: hilfy
Date Posted: 13 Feb 2009 at 1:34pm
I haven't worked with VB or DataViews but try this:  After the DataView structure has  been updated, open the report design and select "Set Location" from the Database menu.  Point it to the DataView.  This should bring up a box that shows any field differences and allow you to map them to the new fields.
 
If that doesn't work, try selecting "Verify Database" from the Database menu.  It should come up with a message that the database has changed and it's "proceeding to fix up the report".  This will delete the renamed field from anywhere it's located (on the report or in formulas) so you'll have to re-add it to the report and update the formulas before it will run correctly.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: StephanieD
Date Posted: 16 Feb 2009 at 8:04am
ha, you're a genius.

I had to tweak your idea a little, but it got me looking in the right spot. I made a copy of the original database, changed the field names to the new names, and pointed to the new database instead. Since my code disconnects the CR report from the database anyway and reconnects it to my dataview that is produced at run time, it doesn't matter that CR was once pointed to a temp copy of a database that no longer exists - all that counts is that we fooled CR into changing the field names on the report.

What I really need to learn how to do is create an .xsd file containing the TableAdapter to perform the query I need, plus the corresponding DataTable to store the data. But this solution was easier for now. THANKS!!



Posted By: aluckhaupt
Date Posted: 30 Jan 2012 at 1:35pm
I ran into an issue where I wanted to substitute one view for another and this solution was wonderful. Thanks for posting it, even if it was almost 3 years ago.



Print Page | Close Window