Konu: Kodu gerçekten çok beğendim. İlgilenen olabilir.
http://www.foxite.com/forum/read.aspx?id=0000137381
*!* Author: Cetin Basoz
public oForm
oForm = createobject('MyForm')
oForm.show
define class myForm as form
datasession = 2
height = 300
width = 450
caption='Unpivot Sample'
add object myGrid as grid with ;
height = 300, width = 450, recordsource = 'crsFrequency'
procedure load
select t1.Country, City, cnt(*) as Frequency, t2.Frequency as freqCountry ;
from (_samples+'data\customer') t1 ;
INNER join ;
(select Country, cnt(*) as Frequency ;
from (_samples+'data\customer') group by 1) t2 ;
on t1.Country == t2.Country ;
group by 1,2,4 ;
into cursor crsFrequency
endproc
procedure init
with this.myGrid
bindevent(.columns(1).Text1,'DblClick',this,'HandleDblClick')
bindevent(.columns(2).Text1,'DblClick',this,'HandleDblClick')
bindevent(.columns(3).Text1,'DblClick',this,'HandleDblClick')
bindevent(.columns(4).Text1,'DblClick',this,'HandleDblClick')
endwith
endproc
procedure HandleDblClick
local lcTitle
do case
case inlist(upper(varread()),'COUNTRY','FREQCOUNTRY')
select Country,City,Cust_id,Company,Contact ;
from (_samples+'data\customer') ;
where Country == crsFrequency.Country ;
order by 1,2 ;
into cursor crsUnPivot ;
nofilter
lcTitle = textmerge("Country:<<crsFrequency.Country>> Frequency:<<_Tally>>")
case inlist(upper(varread()),'CITY','FREQUENCY')
select Country,City,Cust_id,Company,Contact ;
from (_samples+'data\customer') ;
where Country == crsFrequency.Country and ;
City == crsFrequency.City ;
order by 1,2 ;
into cursor crsUnPivot ;
nofilter
lcTitle = textmerge("Country:<<crsFrequency.Country>> "+;
"City:<<crsFrequency.City>> Frequency:<<_Tally>>")
endcase
browse title m.lcTitle
endproc
enddefine
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır. Türk Atasözü