cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

StartsWith filter not working when using the || (or) operator: The query is not valid

Started out with a SortByColumns, no stripped down to only filter to find the issue. But cant see whats wrong.

 

Filter(Source; StartsWith(Title; TextSearchBox1.Text) || StartsWith(Title2; TextSearchBox1.Text))

I have also tried this:

Filter(Source; (StartsWith(Title; TextSearchBox1.Text) || StartsWith(Title2; TextSearchBox1.Text)))

 

I copied the example from this page:

https://powerapps.microsoft.com/en-us/tutorials/function-startswith/

 

Filter( Customers, StartsWith( Name, SearchInput.Text ) || StartsWith( Company, SearchInput.Text ) )

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi Rfla,

 

It seems that I got why you are getting this error. I found that if there is no value in the Text input control, I would also get the error message, but once I enter a value in it, the error disappears.


Have you tried to enter a value to see if the error would disappear?

 

I found a workaround for this, please try to use IsBlank function, I configured it looks like below, it is now working fine on my side:
if(IsBlank(TextInput1.Text),'Holidy apply',Filter('Holidy apply',StartsWith(Title,TextInput1.Text)||StartsWith(w5ka,TextInput1.Text)))

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Highlighted
Community Support
Community Support

Hi Rfla,

 

What’s the data source? Is it SharePoint list? What’s the column type?

 

I tried the StartsWith function with the ||(OR) operator, it just works fine on my side.

 

I am working with SharePoint list, the two columns I am using are Text column types.
In the app, add a Gallery control and a Text input1 control. Then set the Items property of the Gallery as:
Filter('Holiday apply',StartsWith(Title,TextInput1.Text)||StartsWith(w5ka,TextInput1.Text))

 

Could you please try again with it and let me know the result?

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hi @v-yamao-msft thanks for feedback, still not able to get this working.

Yes SharePoint list. Columns are text fields. Tested in desktop app as well as browser. Standard SP list.

Last test was this : Session ID: ed990eef-cbe5-a09e-689f-d269fd44670f

 

Version: 5.0.592

Could it be some regional issues. located in the Nordic part of Europe.

 

In the browser version I don't see the '' around the source. Tried to add them manually without any luck.

 

I have tried this in browser version:

Filter('Source',StartsWith(Title,TextSearchBox1.Text)||StartsWith(Text2,TextSearchBox1.Text))

Filter('Source',(StartsWith(Title,TextSearchBox1.Text)||StartsWith(Text2,TextSearchBox1.Text)))

Filter(Source,(StartsWith(Title,TextSearchBox1.Text)||StartsWith(Text2,TextSearchBox1.Text)))

Filter(Source,StartsWith(Title,TextSearchBox1.Text)||StartsWith(Text2,TextSearchBox1.Text))

Highlighted

Hi Rfla,

 

Are you using PowerApps studio for Web? Just now I tried this issue on PowerApps studio for Windows, and it worked fine.
Do you have PowerApps studio for Windows? If you have one, please try with the same function on it to see if it works.

 

This time I tried the same steps and same code I did on desktop studio. I found that after I entered the code, there are three yellow triangles on the app, but no error shown on the code I entered.

2.PNG
Then I clicked each triangles, an error “Invalid Name” was shown. So I tried to change ThisItem.Heading to ThisItem.Title, then the yellow triangle disappeared. The same actions with other two triangles.

 

After I modified all the Text property of each Text box controls, the code worked as expected.

 

If you are getting the same issue with me on PowerApps studio for Web, please try my steps to see if it works.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hi @v-yamao-msft, the issue originated from the desktop version, just tried today the browser version to see if it gave any additional hints on the error.

 

So same issue for desktop version.

I only see this yellow warning -  The requsted operation is invalid. Server response: The query is not valid
I checked the Text values for the fields as well.

Highlighted

@v-yamao-msft

 

Fiddler gave me this:
{"status":400,"message":"The query is not valid.","source":"https://******.*********.com/sites/*******//_api/web/lists/getbytitle('Leads')/Items?$expand=Author,Editor&$select=*,Author/Name,Editor/Name&$top=500&$filter=(true)or(true)","errors":["-1","Microsoft.SharePoint.SPException"]}

Highlighted

Fiddler.png

 

I can see an extra forward slash in the Get request. Not sure if its linked to my issue or not.

Highlighted

Hi Rfla,

 

It seems that I got why you are getting this error. I found that if there is no value in the Text input control, I would also get the error message, but once I enter a value in it, the error disappears.


Have you tried to enter a value to see if the error would disappear?

 

I found a workaround for this, please try to use IsBlank function, I configured it looks like below, it is now working fine on my side:
if(IsBlank(TextInput1.Text),'Holidy apply',Filter('Holidy apply',StartsWith(Title,TextInput1.Text)||StartsWith(w5ka,TextInput1.Text)))

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Great 🙂 Missed that simple check.
So this should be mentioned in this link as well?

https://powerapps.microsoft.com/en-us/tutorials/function-startswith/

Highlighted
Advocate I
Advocate I

Hi v-yamao-msft,

Any "If" condition in the formula of the "Items" Gallery property causes the Gallery to behave unpredictably when the data in the source is updated.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,238)