[Zope] Getting single values out of lists

Jim Sanford jsanford@atinucleus.com
Tue, 8 Aug 2000 11:57:54 -0500


This should work:

<dtml-in substract>
  <dtml-if "_['sequence-item']!=''">
    update artikel_table set artikel_qty=artikel_qty - <dtml-sqlvar "_['sequence-item']" type=int>
      where artikel_id=<dtml-sqlvar "artikel_id[ _['sequence-index'] ]" type=string> 
    <dtml-var sql_delimiter>
  </dtml-if>
</dtml-in>

 __________________________________________________________________
 
              Jim Sanford
      .       Database Engineer
     / \  /   Accelerated Technology, Inc.
    /   /     720 Oak Circle Drive East
   /  /  \    Mobile, AL 36609
  / /     \   Voice: 334-661-5770  fax: 334-661-5788
 /         \  E-Mail: jsanford@atinucleus.com
              Web: http://www.atinucleus.com
  
 Nucleus.  All You NEED in an RTOS.  Royalty Free
 __________________________________________________________________


----- Original Message ----- 
From: Borno Janekovic <Borno.Janekovic@gmx.de>
To: <zope@zope.org>
Sent: Tuesday, August 08, 2000 11:13 AM
Subject: [Zope] Getting single values out of lists


Hi,

I have a page wich is created out of a database. For every artikel (item)
I have a description and a number of available items.
The page has multiple rows (depending on the database content)
in every row is a input-box in wich the user can enter a number. This
number needs to be substracted from the available items number of the
correct artikel.

My question is how can I get the correct tuple of items out of the list.

For example

In every row I have the substract box and a hidden field with the primary
key:
<input type="text" size=5 value="" name=substract>
<input type="hidden" value="<dtml-var artikel_id>" name="artikel_id">

When I submit the Form I get with the following lines 

<dtml-in "REQUEST.form.items()" sort>
   <dtml-var sequence-key>:<dtml-var sequence-item><br>
</dtm-in>

the content

substract = ['12', '', '', '', '', '', '', '', '', '']
artikel_id = ['20000808095658', '20000808095503', '20000808095341',
'20000808095744', '20000731135126', '20000808092056', '20000808092333',
'20000808092723', '20000808095232', '200007311227'] 

and this is correct. This means that a user has entered 12 for the
artikel_id 20000808095658.

How can I get the single values, so that I can use them? 

How can I extract the values from the list to use the tuple in a
sql-statement? 

Help would be great.

Thanxs 

Borno



-- 
Sent through GMX FreeMail - http://www.gmx.net


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )