Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to implement search and filter functionality for my extension. For this purpose I'm using searchResult method.
As I understand this method could search by field in the model, but not by expression.
So the question is: How to search by Expression with help of API?
(For example: we have we have following fields in the model: UserName, ChildrenCount.
I want to search by field =if(not IsNull(ChildrenCount) or ChildrenCount = 0, UserName))
Thanks
Hi Ilya,
we've used selectMatch method to accomplish searching by expression to select values in a field.
Alex
Hi Ilya,
we've used selectMatch method to accomplish searching by expression to select values in a field.
Alex
Hi Alex,
Thank you for answer.
I've tried Field API, but faced the trouble that It does not filter values if the expression is not single field like 'UserName' but the one that I noticed before. Here is my code (I removed class names to make it readable):
myfield.OnData.bind( function() {
myfield.rows.forEach( function(row, i) {
$element.find("ul").append("<li data-index='" + row.qElemNumber + "'>" + row.qText + "</li>");
});
$element.find("li").click( function() {
app.field(fields).select([$(this).data("index")], true, true); // <-- this method does not work for field like "=if(...)"
});
});
Thanks
Ilya
In your example, were you trying to limit the values in field UserName to those for which the condition of ChildrenCount = 0 or null is true?
This is an example of expression that I would like to use for filtering. It could be the different type of "if" like expression.
Actually I found the walk around for this issue. Found how to have an ability to search with search suggestions, how to search and select by expression fields. That is something that i need to avoid using APP API search methods.
Thanks.