[mapserver-users] How Filter items only if provided parameter

2013-02-23 Thread Andrea Peri
Hi,

I need to set a layer to allow to retrieve in the response all the
elements available in the layer, and when the request has a specific
parameter it should apply a filter to limit the show to only the
filtered geometries.

To do this until now I have set this configuration:

LAYER
   ...
DATA geometry from table using unique gid srid=25832
FILTER PK_FIELD like '%idvalue%' 
VALIDATION
  'idvalue' '^[a-zA-Z0-9\-_]+$'
END
   ...
   METADATA
  'default_idvalue' '%'

This configuration work pretty well when the PK is a string field.
Infact is the request has no the idvalue parameter it show all the
records , thx to the default_idvalue  % definitioni,
instead if the request has a parameter as example
..idvalue=xxx1

It show only the specific item having PK_FIELD=xxx1

Now I have the same need for a layer where the PK is numeric.

With this layer the solution described seem don't work, infact the
'default_idvalue' '%'

is not working with a numeric field.

There same other solution to have the same result?

I need to show all the records and apply the filter only when there is
a specific parameter in the request.

Thx,

-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] How Filter items only if provided parameter

2013-02-23 Thread Smith, Michael ERDC-RDE-CRREL-NH
Andrea,

What I do is set the default_idvalue to 1=1 and change the filter to
FILTER %idvalue%. Then the cgi value is something like idvalue=id=1

Your valididation regex becomes more complex though.

Mike

-- 
Michael Smith

US Army Corps
Remote Sensing GIS/Center



On 2/23/13 7:15 AM, Andrea Peri aperi2...@gmail.com wrote:

Hi,

I need to set a layer to allow to retrieve in the response all the
elements available in the layer, and when the request has a specific
parameter it should apply a filter to limit the show to only the
filtered geometries.

To do this until now I have set this configuration:

LAYER
   ...
DATA geometry from table using unique gid srid=25832
FILTER PK_FIELD like '%idvalue%' 
VALIDATION
  'idvalue' '^[a-zA-Z0-9\-_]+$'
END
   ...
   METADATA
  'default_idvalue' '%'

This configuration work pretty well when the PK is a string field.
Infact is the request has no the idvalue parameter it show all the
records , thx to the default_idvalue  % definitioni,
instead if the request has a parameter as example
..idvalue=xxx1

It show only the specific item having PK_FIELD=xxx1

Now I have the same need for a layer where the PK is numeric.

With this layer the solution described seem don't work, infact the
'default_idvalue' '%'

is not working with a numeric field.

There same other solution to have the same result?

I need to show all the records and apply the filter only when there is
a specific parameter in the request.

Thx,

-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
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