[Zope] Problem with DTML and JOINS(ZSQL)

member madhangc madhangc at opensuse.us
Tue Apr 15 07:08:11 EDT 2008


Dear all, I am developing a web application for a biological research
institute down here in india. I have some
problem in using JOINS. The below is the queries i used,

*SQL query

**File name : drug*
select drug_name,dtype from bio_info_schema.drug order by dtype

*File name:drug_gene_details*
Note : i used both the sql queries seperately, but neither one worked.

SELECT
drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name

FROM drug,drug_gene
WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=<dtml-sqlvar
drug_name type=string>

SELECT
drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name
FROM drug INNER JOIN drug_gene
ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=<dtml-sqlvar
drug_name type=string>

Below is the DTML code i have used,

*File name : view_drug_detail*
<table width = 30% border = 1 >
<tr>
<!-- Table header -->
<th>Drug Name</th>
</tr>
<!-- Iterate through drug details using dtml-in tag -->
<dtml-in drug>
<!-- for each drug , print out the drug name and type of drug -->
<tr>
<td align = center>
<a href="http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/*
drug_gene_details*/drug_name/<dtml-var drug_name>/*view_drug_info*"><dtml-var
drug_name></a></td>
</tr>
</dtml-in>
</table>

*File name : view_drug_info*
<h3><font color= #008000><center>Drug Information
Summary</center></font></h3>
<table width = 100% border = 1 align=center>
<tr>
<th>Drug name</th><td><dtml-var drug_name></td>
</tr>
<tr>
<th>Route of Administration</th><td><dtml-var route_of_admin></td>
</tr>
<tr>
<th>Dosage (Adult)</th><td><dtml-var dose_adult></td>
</tr>
<tr>
<th>Dosage (Child)</th><td><dtml-var dose_child></td>
</tr>
<tr>
<th>Adverse Effects</th><td><dtml-var adverse_effects></td>
</tr>
<tr>
<th>Drug Type</th><td><dtml-var dtype></td>
</tr>
<tr>
<th>Drug Targets</th><td><dtml-var gene_name></td>
</tr>
</table>

This is the error which i got.

Site Error

An error was encountered while publishing this resource.
exceptions.KeyError
Sorry, a site error occurred.
Traceback (innermost last):
    * Module ZPublisher.Publish, line 150, in publish_module
    * Module ZPublisher.Publish, line 114, in publish
    * Module Zope, line 134, in zpublisher_exception_hook
    * Module Shared.DC.ZRDB.DA, line 547, in __getattr__
KeyError: _r
Troubleshooting Suggestions
    * The URL may be incorrect.
    * The parameters passed to this resource may be incorrect.
    * A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML
source for this page.
If the error persists please contact the site maintainer. Thank you for your
patience.

Any kind of suggestion and help will be very useful. Thanks in advance.

-- 
Best Regards
\madhan

Things must be learned only to be unlearned again or, more likely, to be
corrected.
-- Richard Feynman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080415/06833763/attachment.htm


More information about the Zope mailing list