Looks good.
I'll give a try.
Thanks.
>OK. Why not do an SQL SELECT to obtain group counts on the parent table with the appropriate GROUP BY and WHERE !DELETED() to get the numbers you require into a cursor and use those cursor values in your report. For instance:
>SELECT groupingfield,count(*) as cnt ;
>from parent ;
>where !dele ;
>group by 1 ;
>order by 1 ;
>into cursor grpcount
>Then use grpcount.cnt appropriately in your report.
>This SELECT should be much faster than 25 - 30 counts.
>Good Luck.
>
>>Hi:
>>
>> RECCOUNT() won't work because it doesn't respect SET DELETED.
>> Using COUNT was my first choice but the table has over 150,000 records and the report is grouped on a field that could have at least 25 - 30 different values. Even after SELECTING filtered data into a cursor to work with a smaller set of data I still end up with about 100,000 records and more than 20 groups, so COUNT is no an option since it will take forever to count every time the group changes.
>>
>>
>>>Why not just use RECCOUNT('parent'), it is not affected by relations or skip? If that won't work for you just do a COUNT in parent before setting the relationship, store it in a variable and place the variable on your report.
>>>>Hi:
>>>>
>>>> Printing a report where I have two related tables with one to many
>>>> I'm having problems getting a total count of the parent table records.
>>>>
>>>> Example:
>>>> parent.dbf
>>>> field1 n(10)
>>>> child.dbf
>>>> field1 n(10)
>>>> field2 c(5)
>>>>
>>>> use parent order field1
>>>> use child in 0 order field1
>>>>
>>>> set relation to field1 into child
>>>> set skip to child
>>>>
>>>> DETAIL BAND
>>>> parent.field1 child.field2
>>>>
>>>> SUMMARY BAND
>>>> [the count of parent.field1]
>>>> [the count of child.field2]
>>>>
>>>> Because of the one to many relationship both totals are always the same.
>>>> If there is one record in parent for which there is 3 records in child
>>>> I'm supposed to get:
>>>>
>>>> Total of parent: 1
>>>> Total of child: 3
>>>>
>>>>but instead I get
>>>>
>>>> Total of parent: 3
>>>> Total of child: 3
>>>>
>>>>The count of parent.field1 increments while the pointer is moved in child.
>>>>I understand why this is happening, what I don't know is how to fix it.
>>>>
>>>>
>>>>TIA
R. Davila
DBA / Network Administrator
Administracion de Fomento Comercial
Gobierno de Puerto Rico
Still waiting for FoxPro for LINUX