one-to-many join type multiple
Stephen Lime
steve.lime at dnr.state.mn.us
Mon Jan 31 09:02:45 PST 2000
The main query template need to contain a substitution telling the server where
to place the multiple join results. So if you have a join called "labjoin" then in
results.html you'd need a line:
[labjoin]
in the place where the results are supposed to go. Note the reference to the
join (i.e. [labjoin]) needs to sit by itself on a line due to the complexity of the
replacement. Actually, any other code on the line will be lost so comments
would be ok.
Processing for an individual results QUERY goes like this.
1) QUERY template is processed
2) if [joinname] is found then the JOIN templates are processed: header, template (multiple times), and finally the footer
3) processing continues on QUERY template
of course all of this can be sandwiched between LAYER header and footers, and WEB header and footers to create
some very complex output.
Steve
Stephen Lime
Internet Applications Analyst
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Paul Cedfeldt <pcedfeldt at crrel.usace.army.mil> 01/31/00 10:32AM >>>
Steve,
Many thanks for your response. I created a join template as per your
instructions, but I'm not quite there yet...
It seems that whatever is in the query template (results.html)
supersedes the join template (and I get an error saying the query
template is required if I try to comment it out!). Also tried having
the query and join template being the exact same file, and putting the
query template after the join in the map file - neither worked...
The result is always just one line with one record listed - always the
last matching record from dres010.dbf for the particular well that has
been "clicked". Sorry to bother you again, but I sure would be happy if
I could get this straightened out....
Thanks,
-Paul
_________________________________________
Paul Cedfeldt
Physical Scientist - GIS
Cold Regions Research & Engineering Lab
72 Lyme Rd, Hanover, NH 03755
Ph: 603-646-4689 Fax: 603-646-4785
Stephen Lime wrote:
>
> Paul: The JOIN template is just about like any other query tempate except that it can only contain replacement strings for the columns present in the joined table. So, if dres010.dbf
> contains the fields d_site_id, date and comments then the template:
>
> <li> Record [D_SITE_ID] ([DATE]): [COMMENTS]<br>
>
> Will print a formatted line for each lab report for the well. The templates can also contain javascript that might be used to build a collection of js objects that could be used to do rudimentatry analysis, populate a graphing applet or whatever. Join header and footers can be used to add opening and closing tag sequences around a set of joined results. For example, to center the above example use a header containing "<center>" and a footer containing "</center>". In general join templates are real small (couple of bytes) files.
>
> Hope this helps. Let me know if it doesn't.
>
> Steve
>
> <<< Paul Cedfeldt <pcedfeldt at crrel.usace.army.mil> 1/27 3:21p >>>
> Hello,
>
> I've been trying, with only partial success, to get a shapefile
> connected to an external dbf with a one-to-many join. When clicking on
> a well on a map, I would like all lab records for that well (contained
> in dres010.dbf) to display.
>
> The join works, but when a well is clicked the template results.html
> only shows info for the last matching record from dres010 for that
> well. I imagine this has something to do with the join template
> otmjoin.html, which should be processed once for each record according
> to the docs, but otmjoin.html is currently empty since I'm not quite
> sure what should be in there.
>
> Any ideas or examples would be greatly appreciated....
>
> Thanks,
>
> -Paul
>
> -------h.map----------------
>
> LAYER
> NAME well
> DESCRIPTION "Wells"
> TYPE point
> STATUS on
> DATA well
> TOLERANCE 5
> QUERY
> TEMPLATE results.html
> JOIN
> NAME labs
> TABLE /free/haines/d_res010.dbf
> FROM holp
> TO d_site_id
> TYPE multiple
> TEMPLATE otmjoin.html
> END
> END
> END
>
> ------results.html---------
>
> <HTML>
> <body bgcolor=#FFFFFF>
>
> Result [rn] <b
> <p>
> <br>Sample Num: [K_SAMPLE]
> <br>Site AP Number: [D_SITE_ID]
> <br>Lab Sample #: [K_LABSAMPI]
> <br>
> </HTML>
More information about the MapServer-users
mailing list