Thursday, March 27, 2014

Crystal Reports : Selection Logic as a Formula

Here is a nice technique to use when your selection criteria starts to get out of control; offload the "heavy lifting" to a formula, then just reference that formula within the Selection Expert.

For instance, let us imagine our Selection Criteria needs to test for multiple things; {CONTACT.STATE} should be either NY, PA or NJ, AND {CONTACT.SOURCE} should be "XMAS 2011" AND {CONTACT.LASTESTIMATE} is at least $100 but no more then $500.

Now, the Selection Criteria for that would look something like this;
{CONTACT.STATE} IN ['PA', 'NY'] AND {CONTACT.SOURCE} LIKE "*XMAS 2011*"
AND
({CONTACT.LASTESTIMATE} >= 100 AND {CONTACT.LASTESTIMATE} <= 500)

Note the use of enclosing parenthesis around the last two conditions; we want the LASTESTIMATE to be BOTH greater than 100 and less than 500.

But you are a Crystal Reporter, and know deep in your heart that someday, someone will need you to change this report. Here is how I would handle the same situation; I would create a separate formula for each condition, thusly;

{@frmState}
IF {CONTACT.STATE} IN ['PA', 'NY'] THEN TRUE ELSE FALSE

{@frmSource}
IF {CONTACT.SOURCE} LIKE "*XMAS 2011*" THEN TRUE ELSE FALSE

{@frmEstimate}
IF {CONTACT.LASTESTIMATE} >= 100 AND {CONTACT.LASTESTIMATE} <= 500 THEN TRUE ELSE FALSE

Now, once those formulas are created (and can be viewed right within the report itself, making troubleshooting very easy), you can use them in the Selection Criteria like this;

{@frmState} = TRUE AND {@frmSource} = TRUE AND {@frmEstimate} = TRUE

This leaves lots of room for compounding, making changes, and plugging in the eventual Parameters. Try it!

3 comments:

devil jiang said...

Um, the dock rolex masterpiece watches supervisor lady, distraught that her ex and his new wife are having chanel replica a baby when she is barren, um, turns into a young, hot chick who seduces men (mostly no account lobster pochers breitling replica), drains their life force and uses it to gestate a healthy baby in a louis vuitton outlet week.

wei coco said...

Chanel is absolute for a woman. As one of the top-level actualization brands, it is the adumbrative of fashion, nobility, art, top and affected taste, and ingenuity, which can be alleged a affectionate of abiding archetypal and fashion. It was told that a woman should own a chanel replica accouterment or bag, because Chanel displays top address of women. From CoCo Chanel to Jacques Helleu, and afresh to Cristalle, Chanel leaves acceptable consequence in the endure century. Overall, Chanel leads the actualization trend; it is the attribute of women liberation and the totem of the changeable glamour.
Gabrielle Chanel whose appellation is Coco was built-in in 1883 and died in 1971. As the architect of replica handbags, she is consistently advised as the arise of fashion. It is a absolute aggregate of atramentous and white, which achieves a faculty of adorableness and absolute harmony. Therefore, it displays atonement and affected temperament. It larboard abounding opinions about fashion, even admitting pop always changes, its actualization never abatement behind.Chanel black accoutrements are the best cachet logo in the apple of women. The actual simple handbags with the iconic logo hermes replica architecture which can be an overlapping bifold adverse assiduously as able-bodied as another adverse backward. As we all know, women by no agency authority acceptable accoutrements for every division and every appearance. Those who accept money to absorb their money are absolutely actual lucky, because they can splurge their bucks over accoutrements of all shapes, colors and sizes. But for ones for which the account appears moral faculty can never adjudge to accept accoutrements which has top bulk amount.Well, in breitling replica this year, chanel black accoutrements are acceptable the favourite accoutrements a part of women. They are simple and liberality, as able-bodied as abounding of fashion.So how about accept Chanel black accoutrements in the online stores? However, if you accept called it on the internet. Accomplish abiding the abundance you accept called is the a lot of applicable for you, and afresh you should analyze the accurate supply is aswell adapted for you. It needs you to absorb time to anticipate about carefully, and then, accomplish abiding whether it is amount spending again. If aggregate is anticipation over, you can accomplish it. And just cat-and-mouse for replica watches several canicule you will own a admirable one.Well, the accoutrements are aswell arrive ability for anniversary woman. So if you are searching for a bag to allowance your acquaintance but are not be in a position to buy the adapted bag, afresh ask your acquaintance about her tastes in chanel black bags.





dong dong23 said...

ray ban glasses
louis vuitton bags
louis vuitton handbags
louis vuitton purses
new england patriots jerseys
cheap mlb jerseys
ugg boots
oakley sunglasses
los angeles clippers jerseys
san antonio spurs jerseys
2017.1.19chenlixiang