[mapserver-users] Mapserver ODBC Access Database Field Concatenation

Donald Kerr donald.kerr at dkerr.co.uk
Sat Nov 13 15:11:18 EST 2010


Hi List,

I want to create a multi line label based on a combination of text and
fields from an Access database. I can connect to the database and return the
required fields but I do not seem to be able to concatenate fields to
produce the required results.

Here's the contents of the ovf file:

<OGRVRTDataSource>
	<OGRVRTLayer name="MyLayer">
		<SrcDataSource>ODBC:@MyDSN</SrcDataSource>
		<SrcSQL>SELECT ('Status: ',[Status],'|','Dia: ',[Diameter])
AS MyLabel FROM MyTable</SrcSQL>
		<GeometryType>wkbPoint</GeometryType> 
		<GeometryField encoding='PointFromColumns' x='Easting'
y='Northing'/>
	</OGRVRTLayer>
</OGRVRTDataSource>

There is not a problem if I simply request the fields alone (substitute the
line below for the one in the code above):

<SrcSQL>SELECT Status, Diameter FROM MyTable</SrcSQL>

The problem seems to be with concatenating fields. I have also tried
concatenation using the word CONCAT with the same results.

Can anyone advise please?

Alternatively is there a better way to produce the multi line label in the
LAYER definition i.e. can I do the concatenation in there?

Many thanks.

Regards,

Donald Kerr



More information about the mapserver-users mailing list