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', valuedocument.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', valuedocument.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 !
أكثر...
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', valuedocument.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', valuedocument.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 !
أكثر...