Deleting fields without losing (linked) column headings

Tuesday 24 December 2019 @ 5:14 pm

Whenever you drag a new database or formula field onto the details band, Crystal will add a column heading for you, automatically. This heading is just a text object but it will stay internally linked to that field. If you move the field horizontally, or change its width, the heading will adjust to match.  If you delete the field, the heading disappears as well.

This can sometimes present a challenge. For example, when you have formatted and aligned column headings and you need to replace the fields below them. When you delete the original fields the headings will also be deleted and then you have to recreate them and reformat them.  I was in this situation twice in the past few days. In one case I had to replace a group of tables with a SQL command, in the other I replaced a SQL command with a subreport. In both cases the database fields on the report had to be replaced. And as soon as I deleted the original fields I saw that the headings also went away. I didn’t want to recreate the headings to match the old ones, so I hit undo and did some experimenting.  I learned two things that allowed me to keep my original headings in place even after the original fields are deleted:

  1. If you copy the headings and paste a second copy of them somewhere else on the report, Crystal will only delete one set.
  2. If the new headings are in a separate section Crystal will delete the headings in the higher section.

So my new approach for this scenario is to:

  • Split the section that contains the headings to create a new temporary subsection.
  • Drag the new subsection to be above the original section.
  • Copy the headings and paste the copies into the new blank section.
  • Insert the new fields into the new subsection (so they won’t create new headings)
  • Use the format painter to format the new fields based on the format of the originals.
  • Use the menu (format > make same size) to size the new fields to match the originals.
  • Delete the original fields, which should delete the new headings in the higher section.
  • Move the new fields to the original section and align them with the original headings.
  • Delete the temporary subsection.

This process adds a few extra steps, but it keeps your original headings exactly as they were and allows the new fields to look exactly like the ones that they replaced.









Leave a Reply

Jeff-Net
Recrystallize Pro

Crystal Reports Server