Re: filtering data from a dbf file by Anders
Anders
Wed Apr 09 19:05:03 CDT 2008
This is a multi-part message in MIME format.
------=_NextPart_000_0073_01C89AAF.4A3D6130
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi John=20
I suggested you do a ou=C3=B6d contain 'atomi
CREATE CURSOR Test ( iter C(15), time Int, valx Numeric( 4,1)
INSERT INTO Test VALUES ( 'Iteration 1 | 1', 0, 0.5)=20
INSERT INTO Test VALUES ( 'Iteration 1 | 1', 1, 0.6)=20
and so on.
There's a problem with 'Iteration 1 | 1' because it's really several =
different data items. One rule for setting up relational tables is that =
the column should contain 'atomic' item of data.=20
Now, in order to get that first 1 in 'Iteration 1 | 1' you have to use =
SUBSTR() to dig it out. It should be in a column by itself.=20
What is stuff like '1 | 1' and '1 | 3' supposed to mean and be used for? =
It's very awkward to handle if it's all in a single column. =20
***********
TEXT TO lcText noshow
Iteration 1 | 1, 0, 0.5
Iteration 1 | 1, 1, 0.6
Iteration 1 | 1, 2, 0.7
Iteration 1 | 1, 3, 0.7
Iteration 1 | 2, 0, 0.4
Iteration 1 | 2, 1, 0.3
Iteration 1 | 2, 2, 0.3
Iteration 1 | 2, 3, 0.4
Iteration 1 | 3, 0, 0.5
Iteration 1 | 3, 1, 1.1
Iteration 1 | 3, 2, 1.2
Iteration 1 | 3, 3, 0.3
Iteration 1 | 4, 0, 0.7
Iteration 1 | 4, 1, 0.4
Iteration 1 | 4, 2, 0.5
Iteration 1 | 4, 3, 1.1
Iteration 2 | 1, 0, 0.3
Iteration 2 | 1, 1, 0.7
Iteration 2 | 1, 2, 0.4
Iteration 2 | 1, 3, 0.7
Iteration 2 | 2, 0, 0.4
Iteration 2 | 2, 1, 0.5
Iteration 2 | 2, 2, 0.7
Iteration 2 | 2, 3, 0.3
Iteration 2 | 3, 0, 0.6
Iteration 2 | 3, 1, 0.7
Iteration 2 | 3, 2, 0.4
Iteration 2 | 3, 3, 0.7
Iteration 2 | 4, 0, 0.4
Iteration 2 | 4, 1, 0.5
Iteration 2 | 4, 2, 0.7
Iteration 2 | 4, 3, 0.3
endtext=20
ALINES(aArr,lcText,1+4,',',CHR(13)+CHR(10))
DIMENSION aArr(ALEN(aArr,1)/3,3)=20
CREATE CURSOR Test (iter Char(15), time int, valx Num(4,1))
INSERT INTO Test FROM ARRAY aArr=20
GO TOP IN Test
BROWSE LAST NOWAIT=20
SELECT SUBSTR(iter,11,1) As iter, time , SUM(valx) FROM Test ;
GROUP BY 1, time INTO CURSOR test1=20
Result:=20
Iter Time Sum_valx =20
1 0 2.1=20
1 1 2.4=20
1 2 2.7=20
1 3 2.5=20
2 0 1.7=20
2 1 2.4=20
2 2 2.2=20
2 3 2.0=20
-Anders=20
------=_NextPart_000_0073_01C89AAF.4A3D6130
Content-Type: text/html;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.6000.16608" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3DArial size=3D2>Hi John <BR>I suggested you do a =
ou=C3=B6d contain=20
'atomi<BR>CREATE CURSOR Test ( iter C(15), time Int, valx Numeric(=20
4,1)<BR>INSERT INTO Test VALUES ( 'Iteration 1 | 1', 0, 0.5) <BR>INSERT =
INTO=20
Test VALUES ( 'Iteration 1 | 1', 1, 0.6) <BR>and so on.<BR>There's a =
problem=20
with 'Iteration 1 | 1' because it's really several different data items. =
One=20
rule for setting up relational tables is that the column should contain =
'atomic'=20
item of data. <BR>Now, in order to get that first 1 in 'Iteration 1 | 1' =
you=20
have to use SUBSTR() to dig it out. It should be in a column by itself.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>What is stuff like '1 | 1' and '1 |=20
3' supposed to mean and be used for? It's very awkward to handle if =
it's=20
all in a single column. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>***********<BR>TEXT TO lcText =
noshow<BR>Iteration 1=20
| 1, 0, 0.5<BR>Iteration 1 | 1, 1, 0.6<BR>Iteration 1 | 1, 2, =
0.7<BR>Iteration 1=20
| 1, 3, 0.7<BR>Iteration 1 | 2, 0, 0.4<BR>Iteration 1 | 2, 1, =
0.3<BR>Iteration 1=20
| 2, 2, 0.3<BR>Iteration 1 | 2, 3, 0.4<BR>Iteration 1 | 3, 0, =
0.5<BR>Iteration 1=20
| 3, 1, 1.1<BR>Iteration 1 | 3, 2, 1.2<BR>Iteration 1 | 3, 3, =
0.3<BR>Iteration 1=20
| 4, 0, 0.7<BR>Iteration 1 | 4, 1, 0.4<BR>Iteration 1 | 4, 2, =
0.5<BR>Iteration 1=20
| 4, 3, 1.1<BR>Iteration 2 | 1, 0, 0.3<BR>Iteration 2 | 1, 1, =
0.7<BR>Iteration 2=20
| 1, 2, 0.4<BR>Iteration 2 | 1, 3, 0.7<BR>Iteration 2 | 2, 0, =
0.4<BR>Iteration 2=20
| 2, 1, 0.5<BR>Iteration 2 | 2, 2, 0.7<BR>Iteration 2 | 2, 3, =
0.3<BR>Iteration 2=20
| 3, 0, 0.6<BR>Iteration 2 | 3, 1, 0.7<BR>Iteration 2 | 3, 2, =
0.4<BR>Iteration 2=20
| 3, 3, 0.7<BR>Iteration 2 | 4, 0, 0.4<BR>Iteration 2 | 4, 1, =
0.5<BR>Iteration 2=20
| 4, 2, 0.7<BR>Iteration 2 | 4, 3, 0.3<BR>endtext=20
<BR>ALINES(aArr,lcText,1+4,',',CHR(13)+CHR(10))<BR>DIMENSION=20
aArr(ALEN(aArr,1)/3,3) <BR>CREATE CURSOR Test (iter Char(15), time int, =
valx=20
Num(4,1))<BR>INSERT INTO Test FROM ARRAY aArr </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>GO TOP IN Test<BR>BROWSE LAST NOWAIT=20
<BR></DIV></FONT>
<DIV><FONT size=3D+0><FONT face=3DArial color=3D#000080=20
size=3D2></FONT></FONT> </DIV>
<DIV><FONT size=3D+0><FONT face=3DArial color=3D#000080 size=3D2>SELECT=20
SUBSTR(iter,11,1) As iter, time , SUM(valx) FROM Test ;<BR>GROUP BY 1, =
time INTO=20
CURSOR test1 <BR></DIV></FONT></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Result: </FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>Iter Time =20
Sum_valx =
<BR>1 =20
=20
0 =
=20
2.1 <BR>1 =20
=20
1 =
=20
2.4 <BR>1 =20
=20
2 =
=20
2.7 <BR>1 =20
=20
3 =
=20
2.5 <BR>2 =20
=20
0 =
=20
1.7 <BR>2 =20
=20
1 =
=20
2.4 <BR>2 =20
=20
2 =
=20
2.2 <BR>2 =20
=20
3 =
=20
2.0 <BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-Anders </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT><FONT=20
face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT><BR> </DIV></BODY></HTML>
------=_NextPart_000_0073_01C89AAF.4A3D6130--