Issue with startsWith and substringof filters in PropertyFieldSPListQueryHost
wilecoyotegenius opened this issue · 0 comments
wilecoyotegenius commented
There is an issue with generating filters for startsWith and substringof operators in PropertyFieldSPListQueryHost.
All fiters are generated in the form of Field operator 'value'
whereas for startsWith it should be startswith(Field,'value')
and for substringOf should be substringof('value',Field)
.
Basically, this part of saveQuery:
queryUrl += this.state.filters[i].field;
queryUrl += "%20";
queryUrl += this.state.filters[i].operator;
queryUrl += "%20'";
queryUrl += this.state.filters[i].value;
queryUrl += "'";
should be changed to:
if (this.state.filters[i].operator === "startswith") {
queryUrl += this.state.filters[i].operator;
queryUrl += "(";
queryUrl += this.state.filters[i].field;
queryUrl += ",'";
queryUrl += this.state.filters[i].value;
queryUrl += "')";
} else if (this.state.filters[i].operator === "substringof") {
queryUrl += this.state.filters[i].operator;
queryUrl += "('";
queryUrl += this.state.filters[i].value;
queryUrl += "',";
queryUrl += this.state.filters[i].field;
queryUrl += ")";
} else {
queryUrl += this.state.filters[i].field;
queryUrl += "%20";
queryUrl += this.state.filters[i].operator;
queryUrl += "%20'";
queryUrl += this.state.filters[i].value;
queryUrl += "'";
}
I'd be happy to fix this issue. Do you accept PRs?