cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheAudioPolice
Level: Powered On

Data source disappears when searching in SP list or collection

Hi all, very new to PowerApps, but I can see the potential. 

 

I'm trying to create a user friendly lookup / edit / create tool for a club membership, pretty standard stuff. 

 

- Created the Sharepoint List

- Added some test data. 

 

I can create the gallery just fine, but when adding a search option to the input field next to it through 

Search(Ledenadministratie, TextInput1.Text, "Lidno")

It removes the data source (see attachment). 

 

I tried to load the sharepoint list into a collection (because of the 500 record limit), which works fine as well, but as soon as I try to search / filter based on the text field, the data source disappears again. 

 

What basic error am I overlooking?? 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Data source disappears when searching in SP list or collection

HI @TheAudioPolice,

Do you want to filter your Gallery items based on Lidno (Number column) column in your SP list?

If the Lidno column is a Number type column in your SP list, I think the StartsWith function could not achieve your needs.

Based on the needs that you mentioned, I think the in operator could achieve your needs. I have made a test on my side, please take a try with the following workaround:1.JPG

Set the Items property of the Gallery to following:

SortByColumns(Filter('20190108_MainList', TextSearchBox1.Text in ID), "Title", If(SortDescending1, Descending, Ascending))

On your side, you should type:

SortByColumns(
Filter(Ledenadministratie, TextSearchBox1.Text in Lidno || TextSearchBox1.Text in Achternaam),
"Lidno",
If(SortDescending1, Descending, Ascending)
)

 

In addition, above formula may cause a Delegation warning issue, in order to get rid of this issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, Ledenadministratie)

Set the Items property of the Gallery to following:

SortByColumns(
Filter(RecordsCollection, TextSearchBox1.Text in Lidno || TextSearchBox1.Text in Achternaam),
"Lidno",
If(SortDescending1, Descending, Ascending)
)

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

8 REPLIES 8
Super User
Super User

Re: Data source disappears when searching in SP list or collection

Hi!

 

You need to set up your 'Items' property to include the value of the searchbox on the left. What you're doing currently is changing the source of the gallery to items where the text value is TextInput1.Text  and the column is "Lidno".

 

Additionally if using Sharepoint you should not use search as it's not a delegable function with PowerApps with SharePoint.

 

So your gallery's items might be something like this right now:

Items =
Ledenadministratie

 

Where you should now make it:

Items =

Filter(Ledenadministratie, StartsWith(Title, Textinput1.Text) )

Please give this a test and let me know if it works for you,

 

Cheers,

@iAm_ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
TheAudioPolice
Level: Powered On

Re: Data source disappears when searching in SP list or collection

Hi and thanks for the reply!

 

I've tried your approach, once I change the items property from "ledenadministratie" to the Filter(Ledenadministratie, StartsWith(Textinput1.Text)), it changes the data source to "no data", as well as throws an red exclamation mark on the gallery... 

Highlighted
TheAudioPolice
Level: Powered On

Re: Data source disappears when searching in SP list or collection

I have worked around the issue by recreating a new application based on the data driven template. 

It now works, although I still do not know what the issue was. The only difference I noticed is that it is default behaviour to not show the "data source" when the filtering formula is off. 

 

I now see that the items value is as follows: 

 

SortByColumns(Filter(Ledenadministratie, StartsWith(Title, TextSearchBox1.Text)), "Title")

 

That seems to work. I'll work from here.

TheAudioPolice
Level: Powered On

Re: Data source disappears when searching in SP list or collection

Hmm, I spoke to soon. 

 

I noticed that the sorting was off. Upon investigation I saw that the filter was referencing a "titel" column (see attachment), when I change that into the "lidno" column, the data source cuts out again. 

 

Ideally, I would like to search either on "lidno" or "achternaam", but either option breaks the gallery. What logic am I missing? 

Super User
Super User

Re: Data source disappears when searching in SP list or collection

Hi,

 

In Sharepoint did you rename your Title field to Achternaam?

 

And Lidno is a number field yes? You can't use StartsWith and a number field, only Text.

 

So if you could try changing the formula to:

SortByColumns(Filter(Ledenadministratie, StartsWith(Achternaam, TextSearchBox1.Text) || Lidno = Value(TextSearchBox1.Text)), "Lidno")

This will search/filter for items where the Achternaam Starts With what is typed in the searchbox, or else it will show items where the Lidno entered in the searchbox is equal to the Lidno. The naming of your SharePoint columns and the type of data stored in them will play a factor in whether this works or not so if you have any problems when implementing this please reply with a screenshot of the error 🙂

 

Cheers,

@iAm_ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
TheAudioPolice
Level: Powered On

Re: Data source disappears when searching in SP list or collection

Titel is a standard column, not used. Achternaam and Lidno are custom columns, where the first type is text, and lidno is indeed a number type. 

 

I changed the filter, it does work with lastname ("achternaam"), not yet with the lidno column. By the way, is there an option to use "contains" instead of StartsWith? 

Community Support Team
Community Support Team

Re: Data source disappears when searching in SP list or collection

HI @TheAudioPolice,

Do you want to filter your Gallery items based on Lidno (Number column) column in your SP list?

If the Lidno column is a Number type column in your SP list, I think the StartsWith function could not achieve your needs.

Based on the needs that you mentioned, I think the in operator could achieve your needs. I have made a test on my side, please take a try with the following workaround:1.JPG

Set the Items property of the Gallery to following:

SortByColumns(Filter('20190108_MainList', TextSearchBox1.Text in ID), "Title", If(SortDescending1, Descending, Ascending))

On your side, you should type:

SortByColumns(
Filter(Ledenadministratie, TextSearchBox1.Text in Lidno || TextSearchBox1.Text in Achternaam),
"Lidno",
If(SortDescending1, Descending, Ascending)
)

 

In addition, above formula may cause a Delegation warning issue, in order to get rid of this issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, Ledenadministratie)

Set the Items property of the Gallery to following:

SortByColumns(
Filter(RecordsCollection, TextSearchBox1.Text in Lidno || TextSearchBox1.Text in Achternaam),
"Lidno",
If(SortDescending1, Descending, Ascending)
)

 

Best regards,

Kris

Community Support Team _ Kris Dai
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

TheAudioPolice
Level: Powered On

Re: Data source disappears when searching in SP list or collection

Hi Kris, 

 

that works perfectly. I had to remove the 

 

If(SortDescending1, Descending, Ascending)

 part as I don't have the toggle switch, but other than that I can continue with my adventures now. Many thanks!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 276 members 5,572 guests
Please welcome our newest community members: