i have a crystal report of sales and its grouped by sale date. this add a grouped by header on report. Is it possible to count how many of this headers are on the report?
the reason is i need to count unique number of sale dates!
thanks
i have a crystal report of sales and its grouped by sale date. this add a grouped by header on report. Is it possible to count how many of this headers are on the report?
the reason is i need to count unique number of sale dates!
thanks
There are two ways. you can use anyone of these method as per your requirement.
1.) Create a sql query and group by the field that you want. how you can get the no of count record in your sql query
Count(1) As TotalItems. You can use that field in your crystal report directly. If you are creating command with group caluse then you don't need to take do any further process to calulate the number of group items.2.) You can create two formula fields 'Initializer
and 'Incremental. In theInitializerformula field you can take anumbervarvariable and assign it with0then you can increment it with+1inIncrementalformula field. This formula field should be placed in your group header. How you can get total number of header printed in report. This process is much easier than 1st. But, in this method you will get total group header only at the end of the report. If you are using this method then don't forget to useWhilePrintingRecordskeyword at the top of the formula in formula field.
for Initializer
WhilePrintingRecords;
numbervar dTotalCount :=0;
for Incremental
WhilePrintingRecords;
numbervar dTotalCount; //do not assign 0 otherwise it will not get correct result
dTotalCount:= dTotalCount + 1;
You can create another formula field to display only dTotalCount value.
WhilePrintingRecords;
numbervar dTotalCount;
dTotalCount; //Don't need to do anything. Just declaration requred.