One to many joins

Stephen Lime steve.lime at dnr.state.mn.us
Tue Feb 22 14:45:00 EST 2000


Your template for the join is the same as the template for the whole query.
This is not correct. Your query template should contain 

[museumdetail]

by itself on a line. This tells the mapserver to expand that line using the
join template. The join template then contains the formatting for a single
joined record and it is repeated for every matching result in the 1-to-many
join. You can also have a join header and footer template to further control
the output. The header and footer are only displayed if the join succeeds.
In a case when you're positive the join will always work you could do 
something like:

<table>
<tr><th>Name</th><th>Location</th></tr>
[museumdetail]
</table>

Where the template for the join called museumdetail looks like:

<tr><td>[NAME]</td><td>[LOCATION</td></tr>

Questions?

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Erich Schroeder <erich at museum.state.il.us> 02/22/00 07:16AM >>>
Hi,
  I have a 3.0007 mapfile set up with point layer of zipcode centroids,
joined to a dbf file with museums. In some cases there are several museums
in the same zip code, and I want a query to list all the records that
match with the zip. Right now it only brings up one record. My layer
section looks like:

LAYER
  NAME zips
  TYPE POINT
  STATUS ON
  DATA zips
  CLASS
    SYMBOL 3
    COLOR 0 0 255
    NAME "IAM Museums"
    EXPRESSION ([MUSEUM] > 0)
  END # class
  QUERYITEM "ZIPCODE"
  QUERY
   EXPRESSION ([MUSEUM] > 0)
   template museum_detail.html
   JOIN
     template museum_detail.html
     name "museumdetail"
     type multiple
     table "museums.dbf"
     from "ZIPCODE"
     to "ZIP"
   END # join
 END # query
END

What have I misunderstood?

Erich

---------------------------------------------------------------------
Erich Schroeder                    Phone: (217)785-0033
Curator, Information Technologies  FAX:   (217)785-2857
Illinois State Museum GIS Lab      Internet: erich at museum.state.il.us 
http://www.museum.state.il.us/ismdepts/anthro/staff/erich/erich.html 
---------------------------------------------------------------------





More information about the mapserver-users mailing list