Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On Entry/On Exit band events
Message
 
 
To
04/04/2001 21:29:41
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00492141
Message ID:
00492191
Views:
12
>Hi Brad -
>
>I tried a simple test, just counting the number of items in the group's detail band.
>
>I created a UDF parktot()
>
>
>SELECT count(account_name) FROM v_mcgann_parkers ;
>WHERE facility=v_mcgann_parkers.facility ;
>INTO ARRAY lajunk
>
>RETURN lajunk(1)
>
>and put the UDF in the group header. The result is the count of all the records in the table, not the group. (logical, since the where would evaluate to true for all records in the table.) I want to make the comparison against the current value of facility in this record, but that is the problem - I don't know how to get that value. I tried a variable, but got a data type mismatch. Thought I might be able to store facility to a variable and have it reset on group change but I think the variable was being treated as logical and hence the data type mismatch. (of course it's hard to tell since you can't suspend and get into the debugger while the report form is running.)
>
>I know this is doable - basically using a UDF to put a total in the group header and I thought it became even easier with the band events in VFP ...
>
>
>>I think your UDF approach was on the right track, but try:
>>
>>SELECT SUM(line_total) FROM line_items ;
>>WHERE invoice_number=maintable.invoice_number ;
>>INTO ARRAY lajunk
>>
>>Substitute "maintable" above with whatever table is driving the report.
>>
>>--Brad

Change your UDF to this:
lcFacility=v_mcgann_parkers.facility
=messagebox(lcFacility)
SELECT count(account_name) FROM v_mcgann_parkers ;
WHERE facility=lcFacility ;
>INTO ARRAY lajunk
 return laJunk[1]
Run it for small subset of data and see, if you'll get lcFacility right. If this would not work, perhaps, you should add fields TotalGroup and populate them before running the report.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform