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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Perform search in sub-...
Power Apps
Unanswered

Perform search in sub-folder based on Tags

(0) ShareShare
ReportReport
Posted on by 986

Hi everyone,
This is a requirement that is not common but is needed for one of project. The thing is we all know on how to do search on records in a sharepoint list. But now what I want to do is that provide a option to 'Add items' which is like:

Sidhant_02_0-1695797026163.png
So as you can see in the above picture in the first pop-up: Displaying a screen (pop-up) where user gets a option to add a folder and inside that folder we can place multiple files

Sidhant_02_1-1695797212665.png

 

Sidhant_02_2-1695797241476.png

 

And then a search option is provided which will perform a global search which will display all the results based on search option (we can do a search based on tags associated with the file or show all files based on the search input) like:

Sidhant_02_3-1695797449748.png


like the MS 365 search provided. So for now I am just want to search based on the tags associated with the file (the tags can be uploaded after uploading the files).
Please let me know on how to implement the above scenario in Canvas App.

 
Regards,
Sidhant.

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Sidhant_02 ,

     

    Perhaps a part of your post is missing? The post ends with "So if anyone has an idea about how to implement the following", but there's nothing following.

  • Sidhant_02 Profile Picture
    986 on at

    Oh, okay I will change that

  • Sidhant_02 Profile Picture
    986 on at

    So currently what I have done is I have created a collection (SearchResults) to store the serachpoint records, my sharepoint list looks like this:

    Sidhant_02_0-1696313399754.png

    Sidhant_02_1-1696313418015.png

    I have created the Tags column which is a multi-line column. In case of searching records with one tag I am able to do it but if a file has more than one tag then there is an issue, like 

    Sidhant_02_2-1696313703178.pngSidhant_02_3-1696313747795.png

    Sidhant_02_4-1696313774666.png

    As you can see above I searched for email so I was expecting two search results E1 from Power Apps and Email from Mendix folder but it just returned the record from Power Apps folder. So for that I tried using this:

     

    ClearCollect(
     SearchResults,
     Filter(
     TagsList, //My SharePoint list
     Or(
     ForAll(
     Split(Lower(txtSearchTags.Text), ","), // Spliting records 
     CountIf(Tags, Tags = Trim(Result)) > 0 
     )
     )
     )
    )

     

     But highlighted that the Or function has some invalid arguments and instead of Table expected a boolean. So I am stuck over here now. If anyone has any idea how to resolve this do share your suggestion.

    Regards,
    Sidhant.

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Sidhant_02 ,

     

    I think these are the correct syntaxis to achieve what you want:

    ClearCollect(
     SearchResults,
     Filter(
     TagsList, //My SharePoint list
     Tags in ForAll(
    			Split(Lower(txtSearchTags.Text), ","),
    			Trim(ThisRecrod.Value)
     )
     )
    )

     

    Please take into account his is very far away from being delegable, so once you hit 2000 items in your data source, this solution will stop working.

  • Sidhant_02 Profile Picture
    986 on at

    Thanks @BCBuizer ,
    For sharing. So as you have mentioned the following expression is not delegable is there any way to make it delegable so in the future there is no problem even if the records keep on increasing.
    On using the expression that you have mentioned on the search button it is not displaying any error but on the formula it does:

    Sidhant_02_3-1696330017730.png

     

     

    Sidhant_02_1-1696329835840.png

    So just corrected the spelling but now I am facing the same issue it is only returning one result i.e. in both my folders (PowerApps,Mendix) there is a record with the tag: 'email'

    Sidhant_02_4-1696330236568.png

    Sidhant_02_5-1696330261114.png

     

    In PowerApps it returns only the record from  Power Apps but I expected it to return E1 and Email

    Sidhant_02_6-1696330334930.png

     


    Regards,
    Sidhant.

     

  • Sidhant_02 Profile Picture
    986 on at

    And similarly if I tried to search for a record with multiple tags like

    Sidhant_02_7-1696330493336.png

    It does not return any match:

    Sidhant_02_8-1696330527237.png

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Sidhant_02

     

    The formula I provided is for a 1:N relationship, but what you describe is for a N:N relationship. 

     

    What you have to do to make this delegable:

    - Change the Tags column to a single line of text. 

    - Only record a single tag per item

    - Use multiple Text input controls, 1 per tag(, or consider using drop down controls)

     

    Change your formula to:

    ClearCollect(
     SearchResults,
    	Filter(
    		TagsList, //My SharePoint list
    		Tags = Lower(Trim(txtSearchText1.Text)) || 
    		Tags = Lower(Trim(txtSearchText2.Text)) || 
    		Tags = Lower(Trim(txtSearchText3.Text)) || 
    		Tags = Lower(Trim(txtSearchText4.Text)) || 
    		Tags = Lower(Trim(txtSearchText5.Text))
    	)
    )

     In this formula you have 5 text input controls and a result will be returned if an item matches the value entered in one of them.

     

    Still the ClearCollect function is not delegable, but at least first the filter is applied before, hopefully limiting the number of returned items to below the Data Row Limit.

  • Sidhant_02 Profile Picture
    986 on at

    Hi @BCBuizer ,
    Okay will check this out. There is a slight change in the requirement currently I was using a multi-line of text to store the tags but now
    1. Instead of using the text column I have to use a choice column  (there will be some choices) and on the search item I need to show the folder name. Searching will be done based on the value selected in drop-down (we were using Text previously) now have to use dropdown.
    like: 
    PowerApps folder: 
    t1.txt tag: security

    Search: security
    Search result should be : Powerapps- t1.txt - security
    (Format: Folder_name - File name - Tag_name)
     
    Regards,
    Sidhant.

  • Sidhant_02 Profile Picture
    986 on at

    So I have added a drop-down and a gallery control. 

    Sidhant_02_0-1696423018568.png

    For drop-down I have used the 'Distinct' keyword to get unique values from the List (have created another list for test purpose named ListTag) but in the drop-down it displays a blank value (which should not)

    Sidhant_02_1-1696423144173.pngSidhant_02_2-1696423164918.pngSidhant_02_3-1696423180019.pngSidhant_02_4-1696423198050.png

    And currently to display the folder name I am using the folder path, but is there a way to just display the name of the folder instead of path

    Sidhant_02_5-1696423330523.png

    Regards,
    Sidhant.

  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Sidhant_02 ,

     

    Folders are also considered items, so that's why the Distinct formula returns a blank as well: Folder items don't have a tag. To fix this use the Choices function instead which should return all possible values for the Tag column as set in SharePoint:

    Choices(ListTag.Tag)

     

    As for the question regarding displaying the folder name, I assume you wish to show the name of the folder where an item resides. To get that you'll still have to use the folder path column, but you can apply some string manipulation to extract only the folder name:

     

    Last(
    	Split(
    		Replace(
    			ThisItem.'Folder path',
    			Len(ThisItem.'Folder path'),
    			1,
    			""
    		),
    		"/"
    	)
    ).Value

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard