The CRM gives a good example of OR-Searches.
What I want to accomplish is a, I call it a multi_column search,
in fact a special AND search.
The idea is that the search criteria are put in 1 global.
Also a calculation of the combined columns have to be created.
Then a method should do the rest.
E.g. If I have the columns NAME and CITY, and COMBICALC (NAME+" "+CITY)
and the global INPUT.
The method should go roughly like this:
find();
COMBICALC = INPUT;
search()
If I type for instance: “ams jans”, all JANSEN’S from AMSTERDAM are searched.
(Or all AMSBERGEN’S from JANSVELD!)
Is this doable in Servoy?
you can use string functions to separate your searchGlobal into mutliple search strings , and then continue your script like in the CRM example
(consider using special separator instead of space.)
eg:
searchGlobal = “jans|den ha”
dividerPoint = searchGlobal.indexOf(“|”,0) //(searchFor,startposition)
var nameSearch = searchGlobal.substring(0,dividerPoint)//(startPos,endPos)
var citySearch = searchGlobal.substring(dividerPoint,searchGlobal.length)
//OR example
controller.find()
name = “#”+“%”+nameSearch+“%” //use #(case insensitive) and %(wildcard) as desired
controller.newRecord()
city = citySearch
controller.search()
//AND example
controller.find()
name = “#”+“%”+nameSearch+“%”
city = citySearch
controller.search()