web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Building a searchfield...
Power Apps
Answered

Building a searchfield from a sharepointlist

(0) ShareShare
ReportReport
Posted on by 166

Hello everyone,

i have a sharepointlist with a column "Bemerkung" (type: single text).

When i put new entries to the list using a form, i would like to see all values of existing entries the column in a searchfield so i can type the first letters and then chosse an existing entry.

I have no idea how to do this. Likewise it should be possible to put new entries to the list.

 

Can you please help me?

Thank you!

Categories:
  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @JürgenD ,

     

    I believe "Search()" should resolve your issue.

     

    "Search()" returns a table from a list by comparing all records with a text.

     

    Search(source; "TextToSearch"; "ColumnName")

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup

     

    Basically, you search in your SharePoint list if any record match the text input in the combobox. If you want to add more items to the search result you can "Collect()" them in the SharePoint list.

     

    Hope this was helpful to you.

  • JürgenD Profile Picture
    166 on at

    Hello @WiZey 

    thank you for your help. Your suggestion is the first step, but one is missing.

    What i want to achieve is:

    - i have a form that shows me the content of a sharepointlist called "Paketeingangsliste"

    - the list contains a column called "Abesender" which is of type single text line

    - the User has to fill out this column for new entries: when he types the first letters he should see matching entries, additional the user can type in new entries

     

    In a combination-field the search parameter does not work.

     

    Kind regards

    Jürgen

  • WiZey Profile Picture
    3,023 Moderator on at

    So you want to make a combobox to:

     

    1. Find existing records based on user's input

    2. Create new records if user's input is not found

     

    This is a bit tricky, but still possible.

     

    My suggestion would be to combine the combobox with a button.

     

    First, enable searching through the combobox by putting "true" in "IsSearchable" property. This will turn the combobox into a semi-textinput to allow the user to fill in some text.

     

    Second, add some code in the "Items" of the combobox with the Search()" I provided earlier. 

    Search(datasource, Self.SearchText, Abesender)

     This will populate the combobox with every record whose "Abesender" contains the text filled in by the user.

     

    As for the button, my suggestion is turning it visible only if the combobox has no items and its "SearchText" is filled.

    IsEmpty(Search(datasource, Self.SearchText, Abesender))
    &&
    Not(IsBlank(ComboBox.SearchText))

     

    That way you can add a "Patch()" in the "OnSelect" of the button to create a new record with the "SearchText" of your combobox to help add more items to your combobox.

    Patch(datasource, Defaults(datasource), {Abesender:ComboBox.SearchText})

     

    Can you try this and see if it works please? 

  • JürgenD Profile Picture
    166 on at

    Hmm, something does not work:

    If the "is searchable"-property of the combobox is set to false, i can see all the entries from the sharepointlist and can choose one of them.

     

    If the "is searchable"-property of the combobox is set to true, i don't see any entries at the beginning and i don't see any suggestions when i start to type text into the combobox.

  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Right, my bad. "Items" property of a combobox require a delegable function to work. "Search()" is not delegable.

     

    You can fix it by using "Filter()" and "StartsWith()".

     

    Filter(source, StartsWith(Column, Self.SearchText))
  • JürgenD Profile Picture
    166 on at

    Hello @WiZey ,

    after spending a lot time with trying i found a solution:

    I added a combobox with the following properties:

    Items: 

    Distinct(Sort(Filter(Paketeingangsliste; StartsWith(Absender; Self.SearchText)) ;Absender;Ascending);Absender)

    Select multiple = False

     

    To delegate the entry of the combobox to the datacard of the form i set the property Default to:

    If(CountRows(ComboBox1.SelectedItems)>0;Concat(ComboBox1.SelectedItems;ComboBox1.Selected.Result);ComboBox1.SearchText)

     

    This works, no matter if i choose an existing entry or just type in text to the combobox.

     

    Without your help i would not have´succeeded.

    Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard