Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Count specific value from groups Post Reply Post New Topic
Author Message
nwohio
Newbie
Newbie
Avatar

Joined: 08 Sep 2011
Location: United States
Online Status: Offline
Posts: 7
Quote nwohio Replybullet Topic: Count specific value from groups
    Posted: 08 Sep 2011 at 10:29am

Needing for a formula to COUNT each of 3 values from grouped column and display in GF.  Values are 0,1,2 from a results column that is grouped by a session id (mySQL).  Have tried formulas and running totals in various ways.  With the following code I can return a total value of all fields but have not returned only 0, only 1, or only 2 to field.

Created variables:
If {table_testcase_execution1.testcase_execution_result}=2 Then "Fail"
Else If {table_testcase_execution1.testcase_execution_result}=1 Then "Pass"
Else If {table_testcase_execution1.testcase_execution_result}=0 Then "Not Tested"
 
Applied 3 formulas (to place formula fields in same row in report) 1 example as follows:
If ({table_testcase_execution1.testcase_execution_result}=1)
Then Count ({@AllBaseCount}, {table_testcase_execution1.campaign_session_id})
 
Sampling of my RTotal effort:
Name...
Field: .result
Type: sum
Evaluate w/ Use a formula: {table_testcase_execution1.testcase_execution_result}= 1
Reset w/ On change of group: .session_id
 
Results from both efforts, however, are sum count of all values.  Need a loop or iteration statement added to specify value (0 or 1 or 2) COUNT returned.
 
Please offer solution.
IP IP Logged
nwohio
Newbie
Newbie
Avatar

Joined: 08 Sep 2011
Location: United States
Online Status: Offline
Posts: 7
Quote nwohio Replybullet Posted: 09 Sep 2011 at 7:10am
Have found the solution, but the solution creates another problem.
Placed if, then, else boolean statement in header followed by sum formula in footer.  Does give me count, however has converted the results column to 3 values (0,1,2) which subsequently yields only those 3 values in results column.
How do I leave the results unchanged and get my count.
 
This is the solution.  Must have dropped formula into results column which then applied boolean to those fields. Easy to do when CR wants mouse precision.  Could not just delete the formula though - had to rebuild report from blank - as formula was saved once and then it's too late to revise.
 
If ({table_.result})=0
Then 1
Else 0
(Place in header)
 
Sum({@Count)}, {table_.session})
(Place in footer)


Edited by nwohio - 12 Sep 2011 at 10:55am
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.047 seconds.