[OpenLayers-Users] Re: Why Filter do not work ?

Lee M. w_ward_W at hotmail.com
Mon Apr 16 02:50:30 EDT 2012


*if i try this :*

var c_filter = new OpenLayers.Filter.Logical({ 
type: OpenLayers.Filter.Logical.OR, 
filters: [ 
new OpenLayers.Filter.Comparison({ 
    type: OpenLayers.Filter.Comparison.EQUAL_TO, 
    matchCase:false, 
    property: 'id', 
    value:(document.getElementById("Text")).value     
    }),   
new OpenLayers.Filter.Comparison({ 
    type: OpenLayers.Filter.Comparison.LIKE, 
    matchCase:false, 
    property: 'name', 
    value: "*" +(document.getElementById("Text")).value + "*"   
    })   
    ] 
});

wfsProtocol.read({             
    filter: c_filter,    	
    callback: processTheQuery, 
    scope: strategy 
         }) 


*the first filter works fine. but the second doesn't, when i searched for
name: Peter Lyam, i got this error :*
<ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>java.lang.RuntimeException: java.io.IOException
java.io.IOException
null

*ERROR: invalid input syntax for integer: "Peter Lyam"*

  Position: 380</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>


*and if i try :*

var id_filter = new OpenLayers.Filter.Comparison({ 
    type: OpenLayers.Filter.Comparison.EQUAL_TO, 
    matchCase:false, 
    property: 'id', 
    value:(document.getElementById("searchText")).value     
    });   
var name_filter = new OpenLayers.Filter.Comparison({ 
    type: OpenLayers.Filter.Comparison.LIKE, 
    matchCase:false, 
    property: 'name', 
    value: "*" +(document.getElementById("searchText")).value + "*"   
    });  	

var orFilter = new Array(); 
orFilter.push(id_filter); 
orFilter.push(name_filter);	


                           	   
wfsProtocol.read({             
    filter: new OpenLayers.Filter.Logical({ 
                 type: OpenLayers.Filter.Logical.OR, 
                 filters: orFilter 
             }),    	
    callback: processTheQuery, 
    scope: strategy 
         }) 
*
there is nothing sent to the GeoServer. and i got the error :
Uncaught Filter writing not supported for rule type: undefined*

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Why-Filter-do-not-work-tp3918969p4885512.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list