[Zope] Accessing individual items within a list
McDonnell, Larry
lmcdonnell@protonenergy.com
Thu, 29 May 2003 15:07:03 -0400
Hi,
The serail number has 3 records (cell_number) I wish to update each record
with the proper pbtemp information.
My input is still as follows:
<dtml-in expr="_.range(3)">
<input type="text" name="pbtemp[sequence-index]" size="6">
</dtml-in>
Alexis Roda sent me directly some suggestions that I tried but it produced
an error.
<dtml-call "REQUEST.set('serial_number', 'mem0314701')">
<dtml-call "REQUEST.set('cell_number', 0)">
<dtml-in expr="_.range(3)" prefix="p">
<dtml-call "REQUEST.set('cell_stack_number', cell_number+1)">
<dtml-call "REQUEST.set('cell_number', cell_number+1)">
<dtml-call expr="testing(parameter=pbtemp[p_index])">
</dtml-in>
But I see this error:
Error Type: NameError
Error Value: global name 'pbtemp' is not defined
The zsql is as follows:
update atp_fields
set pbtemp=<dtml-if pbtemp><dtml-if "pbtemp==''">NULL<dtml-else>
<dtml-sqlvar pbtemp type=float></dtml-if><dtml-else>NULL</dtml-if>
where serial_number=<dtml-sqlvar serial_number type="string"> and
cell_stack_number=<dtml-sqlvar cell_stack_number type="int">
The zsql works when I test it. At first I was just trying to display the
values of pbtemp[x], but Alexis gave me zsql call statement so I that is
where I am at now.
-----Original Message-----
From: Passin, Tom [mailto:tpassin@mitretek.org]
Sent: Thursday, May 29, 2003 2:04 PM
To: 'Zope@Zope. Org' (E-mail)
Subject: RE: [Zope] Accessing individual items within a list
[McDonnell, Larry]
>...
> If I display <dtml-var pbtemp[sequence-index], I will see ['11', '22',
> '33']. I need to store each variable in the three seperate
> rows in a table.
>
> Row1 pbtemp[1]
> Row2 pbtemp[2]
> Row3 pbtemp[3]
> I believe I need to use another <dtml-in expr="_.range(3)">
> statement but I
> am coming up short in the correct syntax.
First you have to decide what HTML you want to produce. Then you can
work out how to generate it.
I take it that you want something like this -
<tr><td><input name='name1'></td></tr>
<tr><td><input name='name2'></td></tr>
<tr><td><input name='name2'></td></tr>
This is easy - you just put it into the loop you already have -
<dtml-in expr="_.range(3)">
<tr><td><input type="text" name="pbtemp[sequence-index]"
size="6"></td></tr>
</dtml-in>
There is no sense trying tp generate anything if you do not know - at
least have a good idea of - the results you want. Always work out the
html first.
If this is not what you had in mind, then please communciate the output
you want.
Cheers,
Tom P
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )