Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
condition like this :
name | stock
A | 0
B | 0
C | 2
D | 1

how to count field name with field condition stock = 0 ?

What I have tried:

Count ({NAME},{STOCK} , "0")
Updated 24-Sep-17 20:33pm

Hi Khabibb,

The Count function does not work in this way.

The easiest method of achieving this is as follows;
a) Create a new Running Total
b) Select the Name field as the Field to Summarize
c) Set Type of Summary to count
d) Select the option Use a formula in the Evaluate section
e) Set the Formula to be tableName.Stock = 0 - select the field you want to count
f) Select the option Never in the Reset section
g) Add the Running Total to the Report Footer section
If you add the Running Total to the Group Footer you will see the total of stock items that have a zero in the first group in the first group footer, the total of stock items that have a zero in the first & second in the second group footer & so on.
Adding the Running Total to the Report Footer displays it at the end of the Report & shows you the total of all Name Items that have a Zero stock number

Kind Regards
Share this answer
Create a running total, let's call it 'clear':

Fields to Summarize: {name}
Type of summary: Count
Evaluate: check 'use a formula' then ->x+2 button and enter your code:

{stock} = 0

Reset: check 'Never', if you want to summarize it for a whole report or
check 'On change of group' and select the group you would like to do this calculation for. 
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900