Fixing Data Issues in Crystal Reports
I was tasked with making alterations to a set of Crystal Reoprts created by an off-shore company. I had never used Crystal Reports, either in VS.NET or anywhere else.
The first task was to change the length of a data field. I made the appropriate alterations to the data table, changing the allowable number of characters from 15 to 50. This worked just as expected in the C# application. But it was not working in the Crystal Reports report. The generated report still only showed a max of 15 characters.
So I fired up the IDE and opened up the proper .RPT file. Looking at this thing was like something there are no words to describe. I loathed working in it. I haven't yet been able to find a way into the guts of the report, to edit things manually, sans the GUI. I don't believe there is a way to do this. It's all done through the GUI, which, in my book, is a huge minus. The whole reason I never ever bought a Mac was because there was no command line interface. Okay, I know that now there is a command line in the Mac OS, but too little too late.
Back to the problem at hand. I found the field in question in the report, right clicked it and was presenting with a menu I didn't fully understand. But hey, it says Format..., that's go to be where to change the field length. WRONG. The only thing format does is format the text, you know, font, color, weight, size, position, all that jazz.
I hit "Browse Field Data..." not really knowing what would happen. I sent me into a wizard to determine which database to use, I selected the proper database, but it showed only 15 of the 50 characters I had in the database for that field. Strike Two.
Select Expert... did nothing for me. It sent me into another wizard interface that didn't have anything to do with field size. And, still, after two days of messing with this thing, I don't know what an expert is.
To the left of the main window, Crystal Reports has a "Field Explorer" which is kind of like the Server Explorer VS has. Right clicking on the database brings up a different context menu. Oooh, what's this? I see there is an item named "Verify Database". This should fix it. I hit that sucker and the thing starts moving, things are happening, I know this because I'm getting tons of dialog boxes talking about what is being updated.
After it finally finishes, I right click on the report field again, and do the "Browse Field Data..." to see if anything has changed. VOILA! It displays the whole 50 characters. Excellent. That was easy! Rebuild the application and run the report. Doesn't work. I am now getting the error:"Error in formula. 'TableName.FieldName' This field name is not known."While I know good and well that field is in that table which is in the database.
Next thing to try was to re-create the report. I copy the report to another file, and remove the data connection and re-connect. But this method ended up giving me 26 prompts for data. After entering the proper data in all 26 prompts, the reports generated properly. However, the user should not have to enter the same piece of data 26 times in order to see the report. Espcially since the probability of the user knowing the correct data to enter is very, very slim.
Finally, I clicked enough menu items to obtain a solution. I selected the Database Expert, the Set Location option and created a new connection, selected the proper database. Finally after 2 1/2 days of messing around with all of this, it worked, and I was able to put this horrid experience behind me.