>My dear Professor
>
>Your codes has solved my problem. But I could not understand them.
>If possible pleaes write some details about them specially about this select statment
>
>Set Ansi On
>Select Date,VOU_TYPE,Cnt(Distinct VOU_NO) As cntVouNo ;
> FROM VOUCHERS ;
> WHERE Date # {} And VOU_TYPE In ;
> ('CP', 'CR', 'JV', 'PR', 'PS', 'SL', 'SS', 'SO', 'SD', 'SC') ;
> Group By Date, VOU_TYPE ;
> order By Date ;
> INTO Cursor v1
>Set ansi off
>
>Please help again
Tariq,
This simply replaces your multiple:
select distinct ... from vouno ....
count to ...
statements. Instead of doing an SQL then count for each vou_type SQL collects counts for each VOU_TYPE at once. Result would look like:
dateX,CP,5
dateX,CR,3
...
dateY,CP,1
...
then scanning for a specific date (dateX for example) cntVouNo values are copied to corresponding memvar. Memvar name is in vou_type. ie:
store cntVouNo to ('m.'+trim(vou_type))
on dateX,CP,5 record stores 5 to m.CP.
The SQL is wrapped with SET ANSI to only collect values for CP,CR... but not for say CPX,CRY...
VOU_TYPE In ;
('CP', 'CR', 'JV', 'PR', 'PS', 'SL', 'SS', 'SO', 'SD', 'SC')
Without SET ANSI ON if you had CPY as vou_type it would be collected too (no harm maybe but no need OTOH).
Cetin