Re: Is there a more efficient way to look up a list?

Bruce Perryman <[email protected]> Wed, 17 May 2006 08:41:11 -0700 (PDT)
Newsgroups gmane.comp.text.fmpp
Message-ID <[email protected]>
--0-845932402-1147880471=:22889
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks for your help and great suggestions.

For the <#break> should that go after the ${x.description?trim} or the </=
#if> or does it matter?

Thanks again.

Daniel Dekany <[email protected]> wrote: Tuesday, May 16, 2006, 5:27:22=
 PM, Bruce Perryman wrote:

> Hello. I hope that I explain this clearly enough.
>
> Let's say I have the code 'BBB' stored in 'myCode' and the following li=
st:
>
> options=3D
> [code:AAA,description:A1,text:A2,
> =EF=BF=BDcode:BBB,description:B1,text:B2,
> =EF=BF=BDcode:CCC,description:C1,text:C2,
> =EF=BF=BDcode:DDD,description:D1,text:D2]
>
> I need to display the description of the code value that I have.
> What I currently do is the following:
>
> =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=
=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD <#list options as x>=20
> =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=
=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD <#if (x.code?trim=3D=3D=
mycode)>=EF=BF=BD=20
> =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=
=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=
=BD ${x.description?trim}
> =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=
=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD =EF=BF=BD=20
> =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=
=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD  =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=
=BD=EF=BF=BD=EF=BF=BD=20
>
> It seems to work. But is there a more efficient way to do this?

What about using a map where the key is the code for the options?

Also, if the <#list> solution remains, put a <#break> after the
${x.description?trim}. Unless, there can be more list items with the
same code.

--=20
Best regards,
 Daniel Dekany



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job ea=
sier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim=
o
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=120709&bid&3057&dat=121642
_______________________________________________
fmpp-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fmpp-open


	=09
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ co=
untries) for 2=A2/min or less.
--0-845932402-1147880471=:22889
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks for your help and great suggestions.<br><br>For the &lt;#break&gt;=
 should that go after the ${x.description?trim} or the &lt;/#if&gt; or do=
es it matter?<br><br>Thanks again.<br><br><b><i>Daniel Dekany &lt;ddekany=
@freemail.hu&gt;</i></b> wrote:<blockquote class=3D"replbq" style=3D"bord=
er-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;=
"> Tuesday, May 16, 2006, 5:27:22 PM, Bruce Perryman wrote:<br><br>&gt; H=
ello. I hope that I explain this clearly enough.<br>&gt;<br>&gt; Let's sa=
y I have the code 'BBB' stored in 'myCode' and the following list:<br>&gt=
;<br>&gt; options=3D<br>&gt; [code:AAA,description:A1,text:A2,<br>&gt; =EF=
=BF=BDcode:BBB,description:B1,text:B2,<br>&gt; =EF=BF=BDcode:CCC,descript=
ion:C1,text:C2,<br>&gt; =EF=BF=BDcode:DDD,description:D1,text:D2]<br>&gt;=
<br>&gt; I need to display the description of the code value that I have.=
<br>&gt; What I currently do is the following:<br>&gt;<br>&gt; =EF=BF=BD=EF=
=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=
=BF=BD=EF=BF=BD=EF=BF=BD &lt;#list options as x&gt;
 <br>&gt; =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=
=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD &lt;#if (x.code?t=
rim=3D=3Dmycode)&gt;=EF=BF=BD <br>&gt; =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=
=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=
=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD ${x.description?trim}<br>&gt; =EF=
=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=
=BF=BD =EF=BF=BD=EF=BF=BD =EF=BF=BD <!--#if--><br>&gt; =EF=BF=BD=EF=BF=BD=
=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=
=EF=BF=BD=EF=BF=BD  <!--#list-->=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=
=BD=EF=BF=BD <br>&gt;<br>&gt; It seems to work. But is there a more effic=
ient way to do this?<br><br>What about using a map where the key is the c=
ode for the options?<br><br>Also, if the &lt;#list&gt; solution remains, =
put a &lt;#break&gt; after the<br>${x.description?trim}. Unless, there ca=
n be more list items with the<br>same code.<br><br>-- <br>Best regards,<b=
r> Daniel Dekany<br><br><br><br>-----------------------------------------=
--------------<br>Using Tomcat but need to do more? Need to support web s=
ervices, security?<br>Get stuff done quickly with pre-integrated technolo=
gy to make your job easier<br>Download IBM WebSphere Application Server v=
.1.0.1 based on Apache
 Geronimo<br>http://sel.as-us.falkag.net/sel?cmd=3Dlnk&amp;kid=120709&amp=
;bid&amp;3057&amp;dat=121642<br>_________________________________________=
______<br>fmpp-open mailing list<br>[email protected]<br>ht=
tps://lists.sourceforge.net/lists/listinfo/fmpp-open<br></blockquote><br>=
<p>
		<hr size=3D1>Yahoo! Messenger with Voice. <a href=3D"http://us.rd.yahoo=
.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=3D39663/*http:=
//voice.yahoo.com">Make PC-to-Phone Calls</a> to the US (and 30+ countrie=
s) for 2=A2/min or less.
--0-845932402-1147880471=:22889--


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642