Print Page | Close Window

IF x then x with count

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22306
Printed Date: 03 May 2024 at 8:50pm


Topic: IF x then x with count
Posted By: BoltzGirl
Subject: IF x then x with count
Date Posted: 16 May 2017 at 5:25am
Using Crystal 2013 - v 14.1.7.1853

I have been trying to move my ( ) around, can't figure out what I am doing wrong on this formula. Then it dawned on me, can I actually do a count combining the IF statement else like I am trying to do?

numberVar totCount01;
if {@Work Days} > 2 and ({GENERIC_VW.USER_DEF2} = "TRUE") then
    totCount01:= totCount01 + 1;
else
if {@Work Days} > 3 and ({GENERIC_VW.USER_DEF2} <> "TRUE") then
    totCount01:= totCount01 + 1;
totCount01;



Replies:
Posted By: DBlank
Date Posted: 16 May 2017 at 10:54am
if you are trying to get two distinct counts no you cannot do it this way, you need two distinct sets of formula to return distinct results. Or create two running totals with two different evaluate formulas.


Posted By: BoltzGirl
Date Posted: 16 May 2017 at 11:04am
Thanks DBlank - was thinking that in my mind, just needed some confirmation! Will proceed with the 2 distinct formulas.


Posted By: kevlray
Date Posted: 17 May 2017 at 7:51am
Or if you have two global/shared variables, you can do two different counts in a formula.  If and when you may want to reset the values will require a separate formula.  And you would need two formulas (one for each variable) to display the values.


Posted By: BoltzGirl
Date Posted: 18 May 2017 at 5:55am
Awesome idea! Thank you!



Print Page | Close Window