function getDataSetForValueList_vlUserManagement_username(displayValue, realValue) {
/**@type {JSFoundSet<db:/sample/table_one>} */
var fs = databaseManager.getFoundSet('db:/sample/table_one');
/** @type {JSDataSet} */
var result = null;
if (displayValue == null && realValue == null) {//field is empty
fs.loadAllRecords();
fs.sort('column_one asc')
result = databaseManager.convertToDataSet(fs,['column_one','column_two']); //[display value, real value]
} else if (displayValue != null) {//field has text
var searchText = utils.stringTrim(displayValue);
var searchArray = searchText.split(' ');
if (fs.find()) {
fs.column_one = '%' + searchArray[0] + '%';
fs.search();
for (var a = 1; a < searchArray.length; a++) {
if (fs.find()) {
fs.column_one = '%' + searchArray[a] + '%';
fs.search(false, true);
}
}
}
fs.sort('column_one asc');
result = databaseManager.convertToDataSet(fs,['column_one','column_two']);
}
return result;
}
Joas wrote:Change your valuelist so it is based on a global method, in that method you can implement it however you want.
peterbliskavka wrote:The way I was able to do this was by attaching a global method to the valuelist. Here is a sample in which I split the search string on spaces:
- Code: Select all
function getDataSetForValueList_vlUserManagement_username(displayValue, realValue) {
/**@type {JSFoundSet<db:/sample/table_one>} */
var fs = databaseManager.getFoundSet('db:/sample/table_one');
/** @type {JSDataSet} */
var result = null;
if (displayValue == null && realValue == null) {//field is empty
fs.loadAllRecords();
fs.sort('column_one asc')
result = databaseManager.convertToDataSet(fs,['column_one','column_two']); //[display value, real value]
} else if (displayValue != null) {//field has text
var searchText = utils.stringTrim(displayValue);
var searchArray = searchText.split(' ');
if (fs.find()) {
fs.column_one = '%' + searchArray[0] + '%';
fs.search();
for (var a = 1; a < searchArray.length; a++) {
if (fs.find()) {
fs.column_one = '%' + searchArray[a] + '%';
fs.search(false, true);
}
}
}
fs.sort('column_one asc');
result = databaseManager.convertToDataSet(fs,['column_one','column_two']);
}
return result;
}
Users browsing this forum: No registered users and 2 guests