Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i need to combine two OCG filters. each one works fine separably but if i combine them using Filter.Logical.OR, the first one works only.

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 + "*"   
    })  
    ] 
}); 

as you can see, the first one expect integer and the other one a string. also i tried:

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 
         }) 

and still, the id_filter works fine. but the name_filter i got the error: ERROR: invalid input syntax for integer: "test name" i don't understand why it should be integer !! and if i try name_filter alone, it works fine !

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.