Re: Using squences with a for lop

new topic     » goto parent     » topic index » view thread      » older message » newer message

--------------Boundary-00=3D_AYMDCJD0000000000000
  charset=3D"iso-8859-1"

Thanks Stewart and the rest of you who offered solutions.  I have to forget=

my 20 years programing in basic and start thinking in Euphoria.  I probably=

will have a lot more questions before I master this language.  At least I a=
m
getting further than I did in Access and Virtual Basic.=0D
 =0D
-------Original Message-------=0D
 =0D
From: EUforum at topica.com=0D
Date: Sunday, October 26, 2003 12:50:58 PM=0D
To: EUforum at topica.com=0D
Subject: Re: Using squences with a for lop=0D
 =0D
=0D
=0D
=0D
If the sequence is not initialized or has less elements than the element yo=
u
=0D
are trying to reference, it doesn't work. You have to set up the sequence =
=0D
to have the correct number of elements.=0D
=0D
e.g.=0D
sequence seq=0D
seq =3D {1,2,3,4,5} -- five elements=0D
seq[6] =3D foobar -- error=0D
=0D
try:=0D
sequence seq=0D
seq =3D repeat(0,6) --set the number of elements up at the start=0D
seq[foo] =3D bar=0D
=0D
or=0D
=0D
sequence seq=0D
seg =3D {1,2,3,4,5} --sample sequence=0D
seq =3D append(seq,foobar) --apend element=0D
=0D
=0D
=0D
StewartML=0D
=0D
=0D
original message:=0D
>From: Ron Austin <ronaustin at alltel.net>=0D
>Reply-To: EUforum at topica.com=0D
>To: EUforum at topica.com=0D
>Subject: Using squences with a for lop=0D
>Date: Sat, 25 Oct 2003 13:43:07 +0000=0D
>=0D
>=0D
>I have made a simple program which stores a couple of fields=0D
>=0D
>- snip=0D
>constant=0D
>Lbl1 =3D create(LText,"Code",Win,20,50,60,20,0),=0D
>Code =3D create(EditText,"",Win,100,50,42,20,ES_UPPERCASE),=0D
>=0D
>Lbl2 =3D create(LText,"Description",Win,20,80,60,20,0),=0D
>Desc =3D create(EditText,"",Win,100,80,278,20,ES_UPPERCASE),=0D
>=0D
>--snip=0D
>=0D
> err =3D db_select_table("Diagnosis")=0D
> err =3D db_insert(getText(Code),Diag_Data)=0D
>--snip=0D
>=0D
>Which is working okay with a couple of fields, but what if I want to=0D
>store 10, or 100?=0D
>=0D
>I know the answer is to use sequences and a for loop. I can get data=0D
>out of a sequence using [], but how do you get it in?=0D
>=0D
>I tried this and that didn't work=0D
>=0D
>sequence=0D
>=0D
>Lbl1 =3D create(LText,"Code",Win,20,50,60,20,0),=0D
>data[1] =3D create(EditText,"",Win,100,50,42,20,ES_UPPERCASE),=0D
>=0D
>Lbl2 =3D create(LText,"Description",Win,20,80,60,20,0),=0D
>data[2] =3D create(EditText,"",Win,100,80,278,20,ES_UPPERCASE)=0D
>=0D
>I've read the manual and looked at programs, but I can't figure this=0D
>out. I need to get this program running and I'm stuck.=0D
>=0D
>=0D
=0D
=0D
=0D
Or send an email to: EUforum-unsubscribe at topica.com=0D
=0D
TOPICA - Start your own email discussion group. FREE!=0D
=0D
=0D
=0D
=0D
.=20
--------------Boundary-00=3D_AYMDCJD0000000000000
Content-Type: Text/HTML;
  charset=3D"iso-8859-1"
Content-Transfer-Encoding: 8bit

<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"=
>
<META content=3D"IncrediMail 1.0" name=3DGENERATOR>
<!--IncrdiXMLRemarkStart>
<IncrdiX-Info>
<X-FID>FLAVOR00-NONE-0000-0000-000000000000</X-FID>
<X-FVER></X-FVER>
<X-CNT>;</X-CNT>
</IncrdiX-Info>
<IncrdiXMLRemarkEnd-->
</HEAD>
<BODY style=3D"BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 12pt; MARGIN: 5px 1=
0px 10px; FONT-FAMILY: Arial" bgColor=3D#ffffff background=3D"" scroll=3Dye=
s ORGYPOS=3D"0" X-FVER=3D"3.0">
<TABLE id=3DINCREDIMAINTABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%"=
 border=3D0>
<TBODY>
<TR>
<TD id=3DINCREDITEXTREGION style=3D"FONT-SIZE: 12pt; CURSOR: auto; FONT-FAM=
ILY: Arial" width=3D"100%">
<DIV>Thanks Stewart and the rest of you who offered solutions.&nbsp; I have=
 to forget my 20 years programing in basic and start thinking in Euphoria.&=
nbsp; I probably will have a lot more questions before I master this langua=
ge.&nbsp; At least I am getting further than I did in Access and Virtual Ba=
sic.<BR>&nbsp;</DIV>
<DIV id=3DIncrediOriginalMessage><I>-------Original Message-------</I></DIV=
>
<DIV>&nbsp;</DIV>
<DIV id=3Dreceivestrings>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>From:</B></I> <A href=3D"mai=
lto:EUforum at topica.com">EUforum at topica.com</A></DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Date:</B></I> Sunday, Octobe=
r 26, 2003 12:50:58 PM</DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>To:</B></I> <A href=3D"mailt=
o:EUforum at topica.com">EUforum at topica.com</A></DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Subject:</B></I> Re: Using s=
quences with a for lop</DIV></DIV>
<DIV>&nbsp;</DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The Euphoria Mailing =
List =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D <BR><BR><BR><BR>If the sequence i=
s not initialized or has less elements than the element you <BR>are trying =
to reference, it doesn't work. You have to set up the sequence <BR>to have =
the correct number of elements.<BR><BR>e.g.<BR>sequence seq<BR>seq =3D {1,2=
,3,4,5} -- five elements<BR>seq[6] =3D foobar -- error<BR><BR>try:<BR>seque=
nce seq<BR>seq =3D repeat(0,6) --set the number of elements up at the start=
<BR>seq[foo] =3D bar<BR><BR>or<BR><BR>sequence seq<BR>seg =3D {1,2,3,4,5} -=
-sample sequence<BR>seq =3D append(seq,foobar) --apend element<BR><BR><BR><=
BR>StewartML<BR><BR><BR>original message:<BR>&gt;From: Ron Austin &lt;<A hr=
ef=3D"mailto:ronaustin at alltel.net">ronaustin at
alltel.net</A>&gt;<BR>&gt;Repl=
y-To: <A href=3D"mailto:EUforum at topica.com">EUforum at
topica.com</A><BR>&gt;T=
o: <A href=3D"mailto:EUforum at topica.com">EUforum at
topica.com</A><BR>&gt;Subj=
ect: Using squences with a for lop<BR>&gt;Date: Sat, 25 Oct 2003 13:43:07 +=
0000<BR>&gt;<BR>&gt;<BR>&gt;I have made a simple program which stores a cou=
ple of fields<BR>&gt;<BR>&gt;- snip<BR>&gt;constant<BR>&gt;Lbl1 =3D create(=
LText,"Code",Win,20,50,60,20,0),<BR>&gt;Code =3D create(EditText,"",Win,100=
,50,42,20,ES_UPPERCASE),<BR>&gt;<BR>&gt;Lbl2 =3D create(LText,"Description"=
,Win,20,80,60,20,0),<BR>&gt;Desc =3D create(EditText,"",Win,100,80,278,20,E=
S_UPPERCASE),<BR>&gt;<BR>&gt;--snip<BR>&gt;<BR>&gt; err =3D db_select_table=
("Diagnosis")<BR>&gt; err =3D db_insert(getText(Code),Diag_Data)<BR>&gt;--s=
nip<BR>&gt;<BR>&gt;Which is working okay with a couple of fields, but what =
if I want to<BR>&gt;store 10, or 100?<BR>&gt;<BR>&gt;I know the answer is t=
o use sequences and a for loop. I can get data<BR>&gt;out of a sequence usi=
ng [], but how do you get it in?<BR>&gt;<BR>&gt;I tried this and that didn'=
t work<BR>&gt;<BR>&gt;sequence<BR>&gt;<BR>&gt;Lbl1 =3D create(LText,"Code",=
Win,20,50,60,20,0),<BR>&gt;data[1] =3D create(EditText,"",Win,100,50,42,20,=
ES_UPPERCASE),<BR>&gt;<BR>&gt;Lbl2 =3D create(LText,"Description",Win,20,80=
,60,20,0),<BR>&gt;data[2] =3D create(EditText,"",Win,100,80,278,20,ES_UPPER=
CASE)<BR>&gt;<BR>&gt;I've read the manual and looked at programs, but I can=
't figure this<BR>&gt;out. I need to get this program running and I'm stuck=
.<BR>&gt;<BR>&gt;<BR><BR>--^-----------------------------------------------=
-----------------<BR>This email was sent to: <A href=3D"mailto:ronaustin@al=
ltel.net">ronaustin at alltel.net</A><BR><BR>EASY UNSUBSCRIBE click here: <A h=
ref=3D"http://topica.com/u/?b1dd66.b6KEgr.cm9uYXVz">http://topica.com/u/?b1=
dd66.b6KEgr.cm9uYXVz</A><BR>Or send an email to: <A href=3D"mailto:EUforum-=
unsubscribe at topica.com">EUforum-unsubscribe at topica.com</A><BR><BR>TOPICA -
=
Start your own email discussion group. FREE!<BR><A href=3D"http://www.topic=
a.com/partner/tag02/create/index2.html">http://www.topica.com/partner/tag02=
/create/index2.html</A><BR>--^---------------------------------------------=
-------------------<BR><BR><BR><BR><BR>. </TD></TR>
<TR>
<TD id=3DINCREDIFOOTER width=3D"100%">
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%">
<TBODY>
<TR>
<TD width=3D"100%"></TD>
<TD id=3DINCREDISOUND vAlign=3Dbottom align=3Dmiddle></TD>
<TD id=3DINCREDIANIM vAlign=3Dbottom align=3Dmiddle></TD></TR></TBODY></TAB=
--------------Boundary-00=3D_AYMDCJD0000000000000--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu