when I did certain statistical operations, that is to have the colored numbers displayed on the xbrowse, everything worked for me
Later I created those arrays directly from the dbf and nothing worked anymore it is as if those arrays were structured differently otherwise there is no explanation.
Then to do a test I loaded the arrays with the old method, i.e. by inserting demo data and then in the On INIt of the dialog I refresh the arrays with those created by the dbf and now my statistics functions work the same but I certainly did not understand why
oDbf:=TDatabase():Open( , cDir+"lotto", "DBFCDX", .T. )
oDbf:setorder(1)
oDbf:gobottom()
aData1 := aData1_array()
aData2 := aData2_array()
......
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( Refresh_data2(oDbf,oSay,oBrw2,nRadio),; //this call Crea_data2(oDbf,nRecord,oBrw2, nTipo )
Refresh_data1(oDbf,oBrw1,adataDbf),; // this call Crea_data1(adata,nRecord,oDbf,oBrw1)
aGet[7]:nHeight:=21.2,;
Eval(oDlg:bResized) )
If I change
aData1 :={}
aData2 :={}
instead of
aData1 := aData1_array()
aData2 := aData2_array()
make error , why ?
these are the array created for demo
- Code: Select all Expand view RUN
- function aData1_array() //for demo
return ;
{ {"Bari",89,58,55,31,67,24,12,44,3,8,573,549,523,545,517} ;
, {"Cagliari",1,88,79,80,59,47,4,10,0,27,392,392,368,404,362} ;
, {"Firenze",47,4,41,62,65,12,8,5,30,6,580,520,553,584,559} ;
, {"Genova",67,7,5,46,44,8,12,4,4,21,373,385,378,365,380} ;
, {"Milano",57,43,64,58,17,7,55,12,15,52,547,537,529,572,562} ;
, {"Napoli",56,79,14,37,90,52,57,16,11,5,542,541,566,560,564} ;
, {"Palermo",53,37,39,24,86,4,6,3,13,8,538,538,582,564,559} ;
, {"Roma",32,7,18,57,44,3,1,16,27,14,557,538,593,551,545} ;
, {"Torino",64,44,31,70,20,17,14,7,27,25,565,528,606,571,592} ;
, {"Venezia",86,67,64,58,22,8,38,10,0,8,640,551,595,565,596} ;
, {"Nazionale",17,47,77,1,6,10,37,22,13,23,181,148,151,135,149} ;
}
function aData2_array() //for demo
return ;
{ {"Bari",89,58,55,31,67,57,54,30,66,23,89,35,86,32,8} ;
, {"Cagliari",1,88,79,80,59,89,80,81,60,77,78,57,69,48,49} ;
, {"Firenze",47,4,41,62,65,51,88,19,22,45,66,69,13,16,37} ;
, {"Genova",67,7,5,46,44,74,72,23,21,12,53,51,51,49,90} ;
, {"Milano",57,43,64,58,17,10,31,25,74,17,11,60,32,81,75} ;
, {"Napoli",56,79,14,37,90,45,70,3,56,3,26,79,51,14,37} ;
, {"Palermo",53,37,39,24,86,90,2,77,49,76,61,33,63,35,20} ;
, {"Roma",32,7,18,57,44,39,50,89,76,25,64,51,75,62,11} ;
, {"Torino",64,44,31,70,20,18,5,44,84,75,24,64,11,51,90} ;
, {"Venezia",86,67,64,58,22,63,60,54,18,41,35,89,32,86,80} ;
, {"Nazionale",17,47,77,1,6,64,4,18,23,34,48,53,78,83,7} ;
}
While the array create from archive are these
- Code: Select all Expand view RUN
- Function Crea_data1(adata,nRecord,oDbf,oBrw1)
local aResult:={}
LOCAL aRuote := { "Bari", "Cagliari", "Firenze", "Genova", "Milano", "Napoli", "Palermo", "Roma", "Torino", "Venezia", "Nazionale" }
IF !oDbf:eof()
oDbf:goto(nRecord)
aadd(aResult,{aRuote[ 1],oDbf:ba1,oDbf:ba2,oDbf:ba3,oDbf:ba4,oDbf:ba5,;
Ritardo(oDbf:ba1,nrecord,1) ,;
Ritardo(oDbf:ba2,nrecord,1) ,;
Ritardo(oDbf:ba3,nrecord,1) ,;
Ritardo(oDbf:ba4,nrecord,1) ,;
Ritardo(oDbf:ba5,nrecord,1) ,;
freq(aData, oDbf:ba1, 1 ),;
freq(aData, oDbf:ba2, 1 ),;
freq(aData, oDbf:ba3, 1 ),;
freq(aData, oDbf:ba4, 1 ),;
freq(aData, oDbf:ba5, 1 ) })
aadd(aResult,{aRuote[ 2],oDbf:ca1,oDbf:ca2,oDbf:ca3,oDbf:ca4,oDbf:ca5,;
Ritardo(oDbf:ca1,nrecord,2) ,;
Ritardo(oDbf:ca2,nrecord,2) ,;
Ritardo(oDbf:ca3,nrecord,2) ,;
Ritardo(oDbf:ca4,nrecord,2) ,;
Ritardo(oDbf:ca5,nrecord,2) ,;
freq(aData, oDbf:Ca1, 2),;
freq(aData, oDbf:ca2, 2),;
freq(aData, oDbf:ca3, 2),;
freq(aData, oDbf:ca4, 2),;
freq(aData, oDbf:ca5, 2) })
aadd(aResult,{aRuote[ 3],oDbf:fi1,oDbf:fi2,oDbf:fi3,oDbf:fi4,oDbf:fi5,;
Ritardo(oDbf:fi1,nrecord,3) ,;
Ritardo(oDbf:fi2,nrecord,3) ,;
Ritardo(oDbf:fi3,nrecord,3) ,;
Ritardo(oDbf:fi4,nrecord,3) ,;
Ritardo(oDbf:fi5,nrecord,3) ,;
freq(aData, oDbf:Fi1, 3 ),;
freq(aData, oDbf:fi2, 3 ),;
freq(aData, oDbf:fi3, 3 ),;
freq(aData, oDbf:fi4, 3 ),;
freq(aData, oDbf:fi5, 3 ) })
aadd(aResult,{aRuote[ 4],oDbf:Ge1,oDbf:ge2,oDbf:ge3,oDbf:ge4,oDbf:ge5,;
Ritardo(oDbf:ge1,nrecord,4) ,;
Ritardo(oDbf:ge2,nrecord,4) ,;
Ritardo(oDbf:ge3,nrecord,4) ,;
Ritardo(oDbf:ge4,nrecord,4) ,;
Ritardo(oDbf:ge5,nrecord,4) ,;
freq(aData, oDbf:Ge1, 4 ),;
freq(aData, oDbf:Ge2, 4 ),;
freq(aData, oDbf:Ge3, 4 ),;
freq(aData, oDbf:Ge4, 4 ),;
freq(aData, oDbf:Ge5, 4 ) })
aadd(aResult,{aRuote[ 5],oDbf:mi1,oDbf:mi2,oDbf:mi3,oDbf:mi4,oDbf:mi5, ;
Ritardo(oDbf:mi1,nrecord,5) ,;
Ritardo(oDbf:mi2,nrecord,5) ,;
Ritardo(oDbf:mi3,nrecord,5) ,;
Ritardo(oDbf:mi4,nrecord,5) ,;
Ritardo(oDbf:mi5,nrecord,5) ,;
freq(aData, oDbf:Mi1, 5 ),;
freq(aData, oDbf:Mi2, 5 ),;
freq(aData, oDbf:Mi3, 5 ),;
freq(aData, oDbf:Mi4, 5 ),;
freq(aData, oDbf:Mi5, 5 ) })
aadd(aResult,{aRuote[ 6],oDbf:na1,oDbf:na2,oDbf:na3,oDbf:na4,oDbf:na5,;
Ritardo(oDbf:na1,nrecord,6) ,;
Ritardo(oDbf:na2,nrecord,6) ,;
Ritardo(oDbf:na3,nrecord,6) ,;
Ritardo(oDbf:na4,nrecord,6) ,;
Ritardo(oDbf:na5,nrecord,6) ,;
freq(aData, oDbf:Na1, 6 ),;
freq(aData, oDbf:Na2, 6 ),;
freq(aData, oDbf:Na3, 6 ),;
freq(aData, oDbf:Na4, 6 ),;
freq(aData, oDbf:Na5, 6 ) })
aadd(aResult,{aRuote[ 7],oDbf:pa1,oDbf:pa2,oDbf:pa3,oDbf:pa4,oDbf:pa5,;
Ritardo(oDbf:pa1,nrecord,7) ,;
Ritardo(oDbf:pa2,nrecord,7) ,;
Ritardo(oDbf:pa3,nrecord,7) ,;
Ritardo(oDbf:pa4,nrecord,7) ,;
Ritardo(oDbf:pa5,nrecord,7) ,;
freq(aData, oDbf:Pa1, 7 ),;
freq(aData, oDbf:Pa2, 7 ),;
freq(aData, oDbf:Pa3, 7 ),;
freq(aData, oDbf:Pa4, 7 ),;
freq(aData, oDbf:Pa5, 7 ) })
aadd(aResult,{ aRuote[ 8],oDbf:rm1,oDbf:rm2,oDbf:rm3,oDbf:rm4,oDbf:rm5,;
Ritardo(oDbf:rm1,nrecord,8) ,;
Ritardo(oDbf:rm2,nrecord,8) ,;
Ritardo(oDbf:rm3,nrecord,8) ,;
Ritardo(oDbf:rm4,nrecord,8) ,;
Ritardo(oDbf:rm5,nrecord,8) ,;
freq(aData, oDbf:Rm1, 8 ),;
freq(aData, oDbf:Rm2, 8 ),;
freq(aData, oDbf:Rm3, 8 ),;
freq(aData, oDbf:Rm4, 8 ),;
freq(aData, oDbf:Rm5, 8 ) })
aadd(aResult,{aRuote[ 9],oDbf:to1,oDbf:to2,oDbf:to3,oDbf:to4,oDbf:to5,;
Ritardo(oDbf:to1,nrecord,9) ,;
Ritardo(oDbf:to2,nrecord,9) ,;
Ritardo(oDbf:to3,nrecord,9) ,;
Ritardo(oDbf:to4,nrecord,9) ,;
Ritardo(oDbf:to5,nrecord,9) ,;
freq(aData, oDbf:To1, 9 ),;
freq(aData, oDbf:To2, 9 ),;
freq(aData, oDbf:To3, 9 ),;
freq(aData, oDbf:To4, 9 ),;
freq(aData, oDbf:To5, 9 ) })
aadd(aResult,{aRuote[ 10],oDbf:ve1,oDbf:ve2,oDbf:ve3,oDbf:ve4,oDbf:ve5,;
Ritardo(oDbf:ve1,nrecord,10) ,;
Ritardo(oDbf:ve2,nrecord,10) ,;
Ritardo(oDbf:ve3,nrecord,10) ,;
Ritardo(oDbf:ve4,nrecord,10) ,;
Ritardo(oDbf:ve5,nrecord,10) ,;
freq(aData, oDbf:Ve1, 10 ),;
freq(aData, oDbf:Ve2, 10 ),;
freq(aData, oDbf:Ve3, 10 ),;
freq(aData, oDbf:Ve4, 10 ),;
freq(aData, oDbf:Ve5, 10 ) })
aadd(aResult,{aRuote[ 11],oDbf:nz1,oDbf:nz2,oDbf:nz3,oDbf:nz4,oDbf:nz5,;
Ritardo(oDbf:nz1,nrecord,11) ,;
Ritardo(oDbf:nz2,nrecord,11) ,;
Ritardo(oDbf:nz3,nrecord,11) ,;
Ritardo(oDbf:nz4,nrecord,11) ,;
Ritardo(oDbf:nz5,nrecord,11) ,;
freq(aData, oDbf:Nz1, 11 ),;
freq(aData, oDbf:Nz2, 11 ),;
freq(aData, oDbf:Nz3, 11 ),;
freq(aData, oDbf:Nz4, 11 ),;
freq(aData, oDbf:Nz5, 11 ) })
oBrw1:setarray(aResult)
Endif
return NIL
FUNCTION Crea_data2(oDbf,nRecord,oBrw2, nTipo )
//-------------------------
LOCAL aTemp := {}
LOCAL aRuote := { "Bari", "Cagliari", "Firenze", "Genova", "Milano", "Napoli", "Palermo", "Roma", "Torino", "Venezia", "Nazionale" }
LOCAL ba1, ba2, ba3, ba4, ba5
LOCAL ca1, ca2, ca3, ca4, ca5
LOCAL fi1, fi2, fi3, fi4, fi5
LOCAL ge1, ge2, ge3, ge4, ge5
LOCAL mi1, mi2, mi3, mi4, mi5
LOCAL na1, na2, na3, na4, na5
LOCAL pa1, pa2, pa3, pa4, pa5
LOCAL rm1, rm2, rm3, rm4, rm5
LOCAL to1, to2, to3, to4, to5
LOCAL ve1, ve2, ve3, ve4, ve5
LOCAL nz1, nz2, nz3, nz4, nz5
IF !oDbf:eof()
oDbf:goto(nRecord)
ba1 := oDbf:ba1; ba2 := oDbf:ba2; ba3 := oDbf:ba3; ba4 := oDbf:ba4; ba5 := oDbf:ba5
ca1 := oDbf:ca1; ca2 := oDbf:ca2; ca3 := oDbf:ca3; ca4 := oDbf:ca4; ca5 := oDbf:ca5
fi1 := oDbf:fi1; fi2 := oDbf:fi2; fi3 := oDbf:fi3; fi4 := oDbf:fi4; fi5 := oDbf:fi5
ge1 := oDbf:ge1; ge2 := oDbf:ge2; ge3 := oDbf:ge3; ge4 := oDbf:ge4; ge5 := oDbf:ge5
mi1 := oDbf:mi1; mi2 := oDbf:mi2; mi3 := oDbf:mi3; mi4 := oDbf:mi4; mi5 := oDbf:mi5
na1 := oDbf:na1; na2 := oDbf:na2; na3 := oDbf:na3; na4 := oDbf:na4; na5 := oDbf:na5
pa1 := oDbf:pa1; pa2 := oDbf:pa2; pa3 := oDbf:pa3; pa4 := oDbf:pa4; pa5 := oDbf:pa5
rm1 := oDbf:rm1; rm2 := oDbf:rm2; rm3 := oDbf:rm3; rm4 := oDbf:rm4; rm5 := oDbf:rm5
to1 := oDbf:to1; to2 := oDbf:to2; to3 := oDbf:to3; to4 := oDbf:to4; to5 := oDbf:to5
ve1 := oDbf:ve1; ve2 := oDbf:ve2; ve3 := oDbf:ve3; ve4 := oDbf:ve4; ve5 := oDbf:ve5
nz1 := oDbf:nz1; nz2 := oDbf:nz2; nz3 := oDbf:nz3; nz4 := oDbf:nz4; nz5 := oDbf:nz5
aAdd( aTemp, { aRuote[ 1], ba1, ba2, ba3, ba4, ba5,;
EstrattoSumDist( ba1, ba2, nTipo ),; // 1-2
EstrattoSumDist( ba1, ba3, nTipo ),; // 1-3
EstrattoSumDist( ba1, ba4, nTipo ),; // 1-4
EstrattoSumDist( ba1, ba5, nTipo ),; // 1-5
EstrattoSumDist( ba2, ba3, nTipo ),; // 2-3
EstrattoSumDist( ba2, ba4, nTipo ),; // 2-4
EstrattoSumDist( ba2, ba5, nTipo ),; // 2-5
EstrattoSumDist( ba3, ba4, nTipo ),; // 3-4
EstrattoSumDist( ba3, ba5, nTipo ),; // 3-5
EstrattoSumDist( ba4, ba5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 2], ca1, ca2, ca3, ca4, ca5,;
EstrattoSumDist( ca1, ca2, nTipo ),; // 1-2
EstrattoSumDist( ca1, ca3, nTipo ),; // 1-3
EstrattoSumDist( ca1, ca4, nTipo ),; // 1-4
EstrattoSumDist( ca1, ca5, nTipo ),; // 1-5
EstrattoSumDist( ca2, ca3, nTipo ),; // 2-3
EstrattoSumDist( ca2, ca4, nTipo ),; // 2-4
EstrattoSumDist( ca2, ca5, nTipo ),; // 2-5
EstrattoSumDist( ca3, ca4, nTipo ),; // 3-4
EstrattoSumDist( ca3, ca5, nTipo ),; // 3-5
EstrattoSumDist( ca4, ca5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 3], fi1, fi2, fi3, fi4, fi5,;
EstrattoSumDist( fi1, fi2, nTipo ),; // 1-2
EstrattoSumDist( fi1, fi3, nTipo ),; // 1-3
EstrattoSumDist( fi1, fi4, nTipo ),; // 1-4
EstrattoSumDist( fi1, fi5, nTipo ),; // 1-5
EstrattoSumDist( fi2, fi3, nTipo ),; // 2-3
EstrattoSumDist( fi2, fi4, nTipo ),; // 2-4
EstrattoSumDist( fi2, fi5, nTipo ),; // 2-5
EstrattoSumDist( fi3, fi4, nTipo ),; // 3-4
EstrattoSumDist( fi3, fi5, nTipo ),; // 3-5
EstrattoSumDist( fi4, fi5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 4], ge1, ge2, ge3, ge4, ge5,;
EstrattoSumDist( ge1, ge2, nTipo ),; // 1-2
EstrattoSumDist( ge1, ge3, nTipo ),; // 1-3
EstrattoSumDist( ge1, ge4, nTipo ),; // 1-4
EstrattoSumDist( ge1, ge5, nTipo ),; // 1-5
EstrattoSumDist( ge2, ge3, nTipo ),; // 2-3
EstrattoSumDist( ge2, ge4, nTipo ),; // 2-4
EstrattoSumDist( ge2, ge5, nTipo ),; // 2-5
EstrattoSumDist( ge3, ge4, nTipo ),; // 3-4
EstrattoSumDist( ge3, ge5, nTipo ),; // 3-5
EstrattoSumDist( ge4, ge5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 5], mi1, mi2, mi3, mi4, mi5,;
EstrattoSumDist( mi1 ,mi2, nTipo ),; // 1-2
EstrattoSumDist( mi1 ,mi3, nTipo ),; // 1-3
EstrattoSumDist( mi1 ,mi4, nTipo ),; // 1-4
EstrattoSumDist( mi1 ,mi5, nTipo ),; // 1-5
EstrattoSumDist( mi2 ,mi3, nTipo ),; // 2-3
EstrattoSumDist( mi2 ,mi4, nTipo ),; // 2-4
EstrattoSumDist( mi2 ,mi5, nTipo ),; // 2-5
EstrattoSumDist( mi3 ,mi4, nTipo ),; // 3-4
EstrattoSumDist( mi3 ,mi5, nTipo ),; // 3-5
EstrattoSumDist( mi4 ,mi5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 6], na1, na2, na3, na4, na5,;
EstrattoSumDist( na1, na2, nTipo ),; // 1-2
EstrattoSumDist( na1, na3, nTipo ),; // 1-3
EstrattoSumDist( na1, na4, nTipo ),; // 1-4
EstrattoSumDist( na1, na5, nTipo ),; // 1-5
EstrattoSumDist( na2, na3, nTipo ),; // 2-3
EstrattoSumDist( na2, na4, nTipo ),; // 2-4
EstrattoSumDist( na2, na5, nTipo ),; // 2-5
EstrattoSumDist( na3, na4, nTipo ),; // 3-4
EstrattoSumDist( na3, na5, nTipo ),; // 3-5
EstrattoSumDist( na4, na5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 7], pa1, pa2, pa3, pa4, pa5,;
EstrattoSumDist( pa1, pa2, nTipo ),; // 1-2
EstrattoSumDist( pa1, pa3, nTipo ),; // 1-3
EstrattoSumDist( pa1, pa4, nTipo ),; // 1-4
EstrattoSumDist( pa1, pa5, nTipo ),; // 1-5
EstrattoSumDist( pa2, pa3, nTipo ),; // 2-3
EstrattoSumDist( pa2, pa4, nTipo ),; // 2-4
EstrattoSumDist( pa2, pa5, nTipo ),; // 2-5
EstrattoSumDist( pa3, pa4, nTipo ),; // 3-4
EstrattoSumDist( pa3, pa5, nTipo ),; // 3-5
EstrattoSumDist( pa4, pa5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 8], rm1, rm2, rm3, rm4, rm5,;
EstrattoSumDist( rm1, rm2, nTipo ),; // 1-2
EstrattoSumDist( rm1, rm3, nTipo ),; // 1-3
EstrattoSumDist( rm1, rm4, nTipo ),; // 1-4
EstrattoSumDist( rm1, rm5, nTipo ),; // 1-5
EstrattoSumDist( rm2, rm3, nTipo ),; // 2-3
EstrattoSumDist( rm2, rm4, nTipo ),; // 2-4
EstrattoSumDist( rm2, rm5, nTipo ),; // 2-5
EstrattoSumDist( rm3, rm4, nTipo ),; // 3-4
EstrattoSumDist( rm3, rm5, nTipo ),; // 3-5
EstrattoSumDist( rm4, rm5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[ 9], to1, to2, to3, to4, to5,;
EstrattoSumDist( to1, to2, nTipo ),; // 1-2
EstrattoSumDist( to1, to3, nTipo ),; // 1-3
EstrattoSumDist( to1, to4, nTipo ),; // 1-4
EstrattoSumDist( to1, to5, nTipo ),; // 1-5
EstrattoSumDist( to2, to3, nTipo ),; // 2-3
EstrattoSumDist( to2, to4, nTipo ),; // 2-4
EstrattoSumDist( to2, to5, nTipo ),; // 2-5
EstrattoSumDist( to3, to4, nTipo ),; // 3-4
EstrattoSumDist( to3, to5, nTipo ),; // 3-5
EstrattoSumDist( to4, to5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[10], ve1, ve2, ve3, ve4, ve5,;
EstrattoSumDist( ve1, ve2, nTipo ),; // 1-2
EstrattoSumDist( ve1, ve3, nTipo ),; // 1-3
EstrattoSumDist( ve1, ve4, nTipo ),; // 1-4
EstrattoSumDist( ve1, ve5, nTipo ),; // 1-5
EstrattoSumDist( ve2, ve3, nTipo ),; // 2-3
EstrattoSumDist( ve2, ve4, nTipo ),; // 2-4
EstrattoSumDist( ve2, ve5, nTipo ),; // 2-5
EstrattoSumDist( ve3, ve4, nTipo ),; // 3-4
EstrattoSumDist( ve3, ve5, nTipo ),; // 3-5
EstrattoSumDist( ve4, ve5, nTipo )}) // 4-5
aAdd( aTemp, { aRuote[11], nz1, nz2, nz3, nz4, nz5,;
EstrattoSumDist( nz1, nz2, nTipo ),; // 1-2
EstrattoSumDist( nz1, nz3, nTipo ),; // 1-3
EstrattoSumDist( nz1, nz4, nTipo ),; // 1-4
EstrattoSumDist( nz1, nz5, nTipo ),; // 1-5
EstrattoSumDist( nz2, nz3, nTipo ),; // 2-3
EstrattoSumDist( nz2, nz4, nTipo ),; // 2-4
EstrattoSumDist( nz2, nz5, nTipo ),; // 2-5
EstrattoSumDist( nz3, nz4, nTipo ),; // 3-4
EstrattoSumDist( nz3, nz5, nTipo ),; // 3-5
EstrattoSumDist( nz4, nz5, nTipo )}) // 4-5
Endif
RETURN aTemp
I did not understand that it changes