[OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar

Eric Lemoine eric.lemoine at camptocamp.com
Thu Aug 5 03:19:39 EDT 2010


On Wed, Aug 4, 2010 at 12:28 PM, Arnd Wippermann <arnd.wippermann at web.de> wrote:
> Hi
>
> Why is it not possible to use '.' (point for singleChar) in a
> OpenLayers.Filter.Comparison.LIKE?

What do you mean exactly?

>
> The Comparision filter 'like' seems not to work as expected.
> It's not possible to use an expression only with a point for a single char
> (.2) or a static string (22).

Again, I don't understand what you mean.

>>> f = new OpenLayers.Filter.Comparison({type: OpenLayers.Filter.Comparison.LIKE, property: "foo", value: ".2"});
>>> f.evaluate({foo: "1"})
false
>>> f.evaluate({foo: "22"})
true
>>> f.evaluate({foo: "12"})
true
>>> f.evaluate({foo: "2"})
false

It looks good to me.


> It causes an error 'this.value.replace is not a function'. It works only in
> conjunction with '*' (*.2, 22*).

Could you please provide an example.

>
> Also I don't understand, why '*2' finds items like 21, 23, 24.

What would you expect? From the Filter Encoding specs: "The wildCard
character matches zero or more characters".

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list