Hi all,
Hopefully, you all are doing well.
Can anyone help me with how can I use the custom value list in the search provider?
var provider = simpleSearch.addSearchProvider(dataProviderID.toLowerCase());
var vlItems = application.getValueListItems(column.valuelist);
if (!vlItems.getMaxRowIndex()) {
return;
}
// add valuelist substitutions
for (var index = 1; vlItems && index <= vlItems.getMaxRowIndex(); index++) {
var vlItem = vlItems.getRowAsArray(index);
provider.addSubstitution(vlItem[0], vlItem[1])
}
paronne wrote:Hi,
you can use substitutions to search real values of a custom valuelist.
- Code: Select all
var provider = simpleSearch.addSearchProvider(dataProviderID.toLowerCase());
var vlItems = application.getValueListItems(column.valuelist);
if (!vlItems.getMaxRowIndex()) {
return;
}
// add valuelist substitutions
for (var index = 1; vlItems && index <= vlItems.getMaxRowIndex(); index++) {
var vlItem = vlItems.getRowAsArray(index);
provider.addSubstitution(vlItem[0], vlItem[1])
}
Please note substution won't be able to find values with partial matches (such as contains or starts with);
it can find only exatch matches.
e.g.
Valuelist values:
admin|1
basic|2
audit|3
user-type:admin // where "admin" is substituted to some stored value 1, will find all records having user type = 1.
user-type:adm // substitution doesn't have a match for "adm", it won'f find any user type.
Regards,
Paolo
Return to Programming with Servoy
Users browsing this forum: Google [Bot] and 19 guests