Click to See Complete Forum and Search --> : count or percentage of fields with value... in a colomb.
kv41282
February 14th, 2010, 05:06 AM
I am searching for a formula (in crystal reports 8.5)
- to count the fields in a colomb {JobRecStatus} which value is equal to 4.
- to calculated the percentage fields in a colomb {JobRecStatus} which value is equal to 4.
(all the fields in this colomb are 100%) how many fields are "4".
jggtz
February 14th, 2010, 09:31 AM
Three Formulas
1. In Report Footer section, to count all the rows
2. In Detail section to count only the rows in wich the field is = to 4
3. In Report footer section to calculate the percentage of rows in wich the field value is = 4
It's good time to learn
kv41282
February 14th, 2010, 10:34 AM
How do these formulas (2 and 3) look like?
jggtz
February 14th, 2010, 12:34 PM
1. Insert a Summary field Counting the field {TableName.JobRecStatus}
Place it in Report Footer (well it place by itself)
Format Field / Suppress
2. Insert a new Formula field
Let's call it MyCounter
Place it in Detail Section
Format Field / Suppress
I'm assuming that JobRecStatus is a string type field
If it's numeric then remove Trim() function and change to 4 instead of "4"
WhilePrintingRecords;
numberVar Counter ;
If Trim({TableName.JobRecStatus})= "4" Then Counter := Counter +1;
Counter;
3. Insert a new Formula field
Let's call it MyPercent
Place it in Report Footer Section
WhilePrintingRecords;
numberVar PerCent;
Percent := {@MyCounter} * 100 / Count ({TableName.JobRecStatus});
PerCent;
Just change TableName by your table's name
JG
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.