Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: IF x then x with count Post Reply Post New Topic
Author Message
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Topic: IF x then x with count
    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;
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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.
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet 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.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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.
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Posted: 18 May 2017 at 5:55am
Awesome idea! Thank you!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.