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

Filter SharePoint Document Content

Hello All,

I am trying to creat a PowerApps for filtering document library based on the file extension , 

My function not working on Checkbox and can not filter documents based on files extenstion.

Any advise, Please.

extension.png 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter SharePoint Document Content

Hi @Keyvan ,

Could you please share a bit more about your scenario?

Do you want to filter your SP Library records based on specific file extension name (which is related to Checkbox)?

 

Based on the formula you provided, I think you have something misunderstanding with the Filter function in PowerApps. When you use Filter function to filter records in a data source, you should specify the column from the data source as Filter column to compare with a specific value.

On your side, the extension.Text is from the Gallery itself rather than the Documents data source. Please consider modify your formula as below:

Filter(
       Documents,
       Last(Split('File name with extension', ".")).Result = "docx"
)

 

In addition, you could not do the Filter operation in the Checkbox, then want the filtered result to be displayed within the Gallery (Is it not supported in PowerApps).

Please consider set the Items property of the Gallery to following formula:

Filter(
       Documents,
       If(
          WordCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "docx",
          true
       ),
       If(
          ExcelCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "xlsx",
          true
       )
)

Note: I assume that you check only one checkbox each time in your app.

 

If you also want to check two Checkbox controls at same time, please modify above formula as below:

If(
   WordCheckbox.Value && ExcelCheckbox.Value,
   Filter(Documents, Last(Split('File name with extension',".")).Result = "docx" || Last(Split('File name with extension',".")).Result = "xlsx"),
   Filter(
       Documents,
       If(
          WordCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "docx",
          true
       ),
       If(
          ExcelCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "xlsx",
          true
       )
   )
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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

4 REPLIES 4
Highlighted
dynamicsedge
Level 8

Re: Filter SharePoint Document Content

@Keyvan 

 

Checkbox Value is True or False

 

Do something like this instead

 

 

If(Checkbox1.Value,Filter(Documents, extension.Text="docx"),If(Checkbox2.Value,Filter(Documents, extension.Text="xlsx"),false  ) )

 

 

You may need to substitute "false" with something else above - such as a statement that shows everything without filters.

 

Does this help?

dynamicsedge
Level 8

Re: Filter SharePoint Document Content

@Keyvan 

 

Also for checking for both boxes checked scenario OR just one checked try this:

 

If(Checkbox1.Value && Checkbox2.Value,Filter(Documents, extension.Text="docx" || extension.Text="xlsx"), If(Checkbox1.Value,Filter(Documents, extension.Text="docx"),If(Checkbox2.Value,Filter(Documents, extension.Text="xlsx"),false  ) ) )

 

 

Keyvan
Level: Powered On

Re: Filter SharePoint Document Content

Thank you @dynamicsedge  but it is not working yet.

I think my filter has a issue. 

I'm getting extension value by this : Last(Split(ThisItem.'File name with extension',".")).Result 

But apparently for some reason extension.Text="docx" not working.

Community Support Team
Community Support Team

Re: Filter SharePoint Document Content

Hi @Keyvan ,

Could you please share a bit more about your scenario?

Do you want to filter your SP Library records based on specific file extension name (which is related to Checkbox)?

 

Based on the formula you provided, I think you have something misunderstanding with the Filter function in PowerApps. When you use Filter function to filter records in a data source, you should specify the column from the data source as Filter column to compare with a specific value.

On your side, the extension.Text is from the Gallery itself rather than the Documents data source. Please consider modify your formula as below:

Filter(
       Documents,
       Last(Split('File name with extension', ".")).Result = "docx"
)

 

In addition, you could not do the Filter operation in the Checkbox, then want the filtered result to be displayed within the Gallery (Is it not supported in PowerApps).

Please consider set the Items property of the Gallery to following formula:

Filter(
       Documents,
       If(
          WordCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "docx",
          true
       ),
       If(
          ExcelCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "xlsx",
          true
       )
)

Note: I assume that you check only one checkbox each time in your app.

 

If you also want to check two Checkbox controls at same time, please modify above formula as below:

If(
   WordCheckbox.Value && ExcelCheckbox.Value,
   Filter(Documents, Last(Split('File name with extension',".")).Result = "docx" || Last(Split('File name with extension',".")).Result = "xlsx"),
   Filter(
       Documents,
       If(
          WordCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "docx",
          true
       ),
       If(
          ExcelCheckbox.Value,
          Last(Split('File name with extension',".")).Result = "xlsx",
          true
       )
   )
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

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

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,666)