Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with startsWith and substringof filters in PropertyFieldSPListQueryHost #41

Open
wilecoyotegenius opened this issue Nov 23, 2020 · 0 comments

Comments

@wilecoyotegenius
Copy link

wilecoyotegenius commented Nov 23, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant