hi to all, supposes you have a ZSQL method of this kind select table1.name, table1.lastname, table2.name, table2.lastname from table1, table2 where table1.cod = table2.cod with ZPT to see them on a table i'll use something like this: <span tal:define="l_ppl python:container.SQLquery()"> <span tal:condition="python:len(l_ppl) > 0"> <table class=modifica> <tr tal:repeat="num python:range(0,len(l_ppl.names()))"> <td span=1 tal:content="python:l_ppl.names()[num]"> Name </td> <td> <input type=text tal:attributes="name python:l_ppl.names()[num]; value python:l_ppl[0][num]" > </td> </tr> </table> </span> </span> however this gives an error : An error was encountered while publishing this resource. Error Type: ValueError Error Value: Duplicate column name, name Am i wrong or this is a big problem of ZPT ? Is there a way to force to user absolute name, instead of relatives ? thanks Samuele
Samuele Giovanni Tonon wrote:
hi to all,
supposes you have a ZSQL method of this kind
select table1.name, table1.lastname, table2.name, table2.lastname from table1, table2 where table1.cod = table2.cod
You need to use this: select table1.name as table1_name, table1.lastname as table1_lastname, table2.name as table2_name, table2.lastname as table2_lastname from table1, table2 where table1.cod = table2.cod
however this gives an error : Error Type: ValueError Error Value: Duplicate column name, name
-- Jaroslav Luke -- Tento e-mail nemu*e obsahovat VIRY jeliko nepocházi z virózního systému M$ Windows!
Jaroslav Lukesh wrote:
Samuele Giovanni Tonon wrote:
hi to all,
supposes you have a ZSQL method of this kind
select table1.name, table1.lastname, table2.name, table2.lastname from table1, table2 where table1.cod = table2.cod
You need to use this:
select table1.name as table1_name, table1.lastname as table1_lastname, table2.name as table2_name, table2.lastname as table2_lastname from table1, table2 where table1.cod = table2.cod yes you're right, but this is a solution using alias, i think zope should handle itself this situation, as far as i can remember, even php can handle this problem..
Regards Samuele
select table1.name as table1_name, table1.lastname as table1_lastname, table2.name as table2_name, table2.lastname as table2_lastname from table1, table2 where table1.cod = table2.cod
yes you're right, but this is a solution using alias, i think zope should handle itself this situation, as far as i can remember, even php can handle this problem..
uhm, i discovered it's a problem related to ZSQL and not (as i first thought) to ZPT. thanks to all for the help, i'll use alias (hope one day ZSQL will solve this problem). Regards Samuele
supposes you have a ZSQL method of this kind
select table1.name, table1.lastname, table2.name, table2.lastname from table1, table2 where table1.cod = table2.cod
however this gives an error :
An error was encountered while publishing this resource.
Error Type: ValueError Error Value: Duplicate column name, name
Try amending to select table1.name, table1.lastname, table2.name as name2, table2.lastname as lastname2 where table1.cod = table2.cod ZSQL methods do not allow you to have two columns with the same name. A -- Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/
Nameclash...try something like "select table1.name as table1_name,...." -aj --On Dienstag, 27. April 2004 11:53 Uhr +0200 Samuele Giovanni Tonon <samu@sferacarta.com> wrote:
hi to all,
supposes you have a ZSQL method of this kind
select table1.name, table1.lastname, table2.name, table2.lastname from table1, table2 where table1.cod = table2.cod
with ZPT to see them on a table i'll use something like this:
<span tal:define="l_ppl python:container.SQLquery()"> <span tal:condition="python:len(l_ppl) > 0"> <table class=modifica> <tr tal:repeat="num python:range(0,len(l_ppl.names()))"> <td span=1 tal:content="python:l_ppl.names()[num]"> Name </td> <td> <input type=text tal:attributes="name python:l_ppl.names()[num]; value python:l_ppl[0][num]" > </td> </tr> </table> </span> </span>
however this gives an error :
An error was encountered while publishing this resource.
Error Type: ValueError Error Value: Duplicate column name, name
Am i wrong or this is a big problem of ZPT ? Is there a way to force to user absolute name, instead of relatives ?
thanks Samuele
_______________________________________________ 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 )
participants (4)
-
Andreas Jung -
Andrew Veitch -
Jaroslav Lukesh -
Samuele Giovanni Tonon