Using Redundancy – Running a field through a “feeder” formula

Monday 2 October 2006 @ 9:51 am

I remember designing a very complex report for a customer where dozens of formulas all referred to the same quantity field in the database. After I wrote all of the formulas, the customer told me that he had given me the wrong quantity field and that I needed to use a different field in all of the formulas. I spent the better part of an hour rewriting all of the formulas to use a different field. But I also got an idea that I still use today on any complex report. Whenever there is a field that is used in more than a dozen or so formulas, I run that field through it’s own “feeder” formula. In other words, I write a simple formula that contains just that one database field. Then, in all of my other formulas, where I would normally use that database field, I use the new formula instead. This means that if I ever need to change the field I only have to change that one formula and everything else is “fed” the change automatically.

This comes in handy with dates as well. There are often several available transaction dates in a record and customers aren’t always clear which one they need to use in their calculations. So I have found that it is more efficient to put that date field into a “feeder” formula and then refer to that formula in all of the other formulas. That way I can get started on the report but make a final decision on which is the appropriate field later on.

One last use of a “feeder” is when a single calculation is needed in dozen’s of formulas. I find it easier to follow the flow of formulas when they are simple so I create the common calculation in one formula and use that formula inside the other fields. This makes the formulas easier to read, and also makes it easier to change since this calculation can now be changed in one place.

(For examples of my most popular formulas, please visit the FORMULAS page on my website.)






One Response to 'Using Redundancy – Running a field through a “feeder” formula'

  1. Ken Hamady - June 25th, 2013 at 10:29 am

    Two newsletter readers shared their thoughts on this article. Thank you both.

    From Mary-Ellen Slattery at LS travel retail:

    Your article “Copying text into Crystal Reports” brings back memories. I used the paste to notepad method also for a while, until I found a neat little free-to-use application called PureText.

    http://www.stevemiller.net/puretext/

    When I need to strip all formatting from text before I paste it, instead of using Ctrl+V, I use the hot-key setup in this app (Windows+V). It effectively does the notepad paste and copy in one step. I find myself using it in a range of different circumstances – pasting into Crystal Reports is definitely one of them!

    —————————
    From Laurie Weaver at Campwise:

    I do a lot of copying from Word in my work when I’m creating custom contracts for our customers. I’ve found that if I select text box and do the following that these issues disappear:

    Right click on text box
    Format Text
    Click Paragraph Tap
    Set all the paragraph marks indents (First Line, Left, Right) to 0 (or use appropriate indents).

    This process allows users to copy from Word and keep things like bold, underline, etc, but not lose any characters.


Leave a Reply

Jeff-Net
Recrystallize Pro

Crystal Reports Server