简体   繁体   中英

Delphi QuickReport COUNT problem

I have one very simple, but very annoying problem. I'm trying to count number of rows with specific condition (for example, some column has value 1) in QuickReport. Data in report are given using stored procedure from SQL Server. I tried to use COUNT function in QRExpr but it shows me some error. Another idea is to use query in code and count number of rows directly from procedure and put it in Label, but also didn't succeed.

Do you have idea how to solve this?

TnX in advance!

Nemanja

The COUNT function in Quickreports doesn't have a condition or receive a parameter. Use it to get the count at the point of printing. If you want to sum conditionally, declare your own private variable in the form that contains QuickRep, add 1 to it conditionally, then print the variable when you need to.

Because I have flag column (value 1 if condition is achieved, 0 if not), one solution can be to use SUM function at that column, so summarized value will be number of rows with that condition. That can be one solution.

But still interested in COUNT function and is it possible to add WHERE condition etc. Also, same question for code solution...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM