One of the legacy projects I support was written in Delphi 7 and uses ACE Reporter. I have only used ACE Reporter once before and very little even then so don't know much about it but it seemed to work fine for what it was doing. I was tasked with adding a column to a report where the data on the report came from a temporary table that gets filled every time it prints. Adding a column to the report implied adding a column to the table. A previous experience updating tables with this app proved to take an inordinate amount of time so I wanted to avoid that if possible. Looking more closely at the dataset, I realized this table (which was also used for another report) had a field which was not being used on the report I was modifying. This meant I could repurpose it and save modifying the database. Yay! The problem was the value I needed to display was a currency value and the only available field was an integer. Oh...
After a little investigation, I noticed the ACE Reporter's label fields have an OnBeforePrint event handler. I've done tricks like this before and figured I'd just multiply the value by 100, store it in the integer field, then hook into the OnBeforePrint and pull out the value, divide by 100, and change the output text to my currency string. I happily set to work.
What I didn't know is that when an ACE Reporter's label fields are hooked to a data set, the output cannot be changed. What was I to do?
After trying several things and watching the hours tick by, I placed another label on the form and in frustration, just set its caption to "Argh!" and ran another test. When I saw "Argh!" appear on the report, I suddenly realized that if the label is not data-bound, it prints the
Caption property. A lightbulb went on in my head and I realized all I had to do was make one little change in my current data-bound label to set the
Caption property of the non-data-bound label and then suppress the output of the data-bound one containing the incorrectly formatted data.
I'm sure there was a much better way to solve this problem if I knew ACE Reporter better but this hack worked! On to the next task!