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?
Hi,
you can use substitutions to search real values of a custom valuelist.
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
paronne:
Hi,you can use substitutions to search real values of a custom valuelist.
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
Thanks, Paolo for your response.
It worked for me.
Marking this thread as RESOLVED.