Hi Donald: To answer your questions...

1. You can't do an AND with [item ...] tags. They are single item only. We'd 
really need to introduce true conditionals into the templates. It's done a bit 
for legend templates but I don't know how much work is necessary to extend 
that. One work around idea would be to create a compound item if using a RDMS 
data source and write patterns against that.

2. Consider filing ticket for that one. Covers item 4 too.

3. I actually had something along those lines in mind at one point. I'll have 
to check my old notes. Note that if the patterns are mutually exclusive you can 
just write:

[item name="A" pattern="1" format="Output1"][item name="B" pattern="2" 
format="Output2"][item name="C" pattern="3" format="Output3" 
nullformat="Output4"]

The default format would just be the null format for one of these. But I agree 
this has it's limits...

Steve

-----Original Message-----
From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Donald Kerr
Sent: Wednesday, July 25, 2012 2:25 PM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] Mapserver Template - Conditionals

Hi List,

A few questions/points on templating:

1.
I know it's possible to use "item" in a template as follows:

[item name="featurecode" pattern="10021"
format="<osgb:theme>Buildings</osgb:theme><osgb:descriptiveGroup>Building</o
sgb:descriptiveGroup>" escape=none]

But, is it possible to do something like:

[item featurecode="10021" pattern="1" AND item lineitem="12345" pattern="2"
format="....."]

That is, returns true of both, or more, criteria are met.

The only other way I can think of doing this is in the SQL query that runs on 
the layer.


2.
Also, when I use use [item ...] and the criteria isn't met, it still causes an 
additional blank line to be created in the output file. It would be quite good 
if it did not create the cr/lf. Maybe nullformat could be used to enforce this 
in some way but nullformat="" still creates a blank line.


3.
It would be nice if the item tag could also deal with a case/select statement 
e.g.

[item name="A" pattern="1" format="Output1"] ELSE [item name="B" pattern="2" 
format="Output2"] ELSE [item name="C" pattern="3" format="Output3"] DEFAULT 
[item name="D" pattern="4" format="Output4"]


4.
And finally, when using:

[resultset layer=LayerName]
[feature]

Two blank lines are created in the output file. It would be good if these tags 
didn't do that.


Many thanks.

Regards,

Donald

_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to