[Chameleon] Re: SQLquery widget and non-map data retrieval

Julien-Samuel Lacroix jlacroix at dmsolutions.ca
Tue Jun 21 16:11:06 EDT 2005


You can use the Table widget to print the result.
In short you need
<cwc2 type="table" sharedresourcename="SQLQuery" >
     <TEMPLATE Name="HEADER" Content="[html content]"/>
     <TEMPLATE Name="BODY" Content="[html content]"/>
     <TEMPLATE Name="FOOTER" Content="[html content]"/>

What you put in your HEADER and FOOTER will be printed above and below 
the BODY part. The BODY part will be repeated once per row in you shared 
resource (This is what hold the result of your SQLQuery internally).

In the BODY, you can put %COL_NAME% (COL_NAME is the column name of in 
your DB). This special tag will be replaced by the value corresponding 

For example you can have (not tested, it is possible that you have to 
html encode some characters.):
<cwc2 type="table" sharedresourcename="SQLQuery" >
     <TEMPLATE Name="HEADER" Content="<select>"/>
     <TEMPLATE Name="BODY" Content="<option name=colname> %colname% 
     <TEMPLATE Name="FOOTER" Content="</select>"/>

Note that you can print everything with this technic, even a javascript 


On 06/21/2005 10:36 AM, Paul Meijer wrote:
> Dear mr Lacroix,
> We are trying to fetch data from a MySQL db to populate a 
> select's option list. Is there a way to use your SQLquery widget to 
> return the query result in an array, so we can publish the array 
> elements into an select's option list elements? Is there an example that 
> illustrates this functionality?
> Thanks in advance
> Paul Meijer

Julien-Samuel Lacroix            jlacroix at dmsolutions.ca
DM Solutions Group               http://www.dmsolutions.ca/

More information about the Chameleon mailing list