cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tagustin2020
Impactful Individual
Impactful Individual

Filter Comment Gallery by Current Project

Hello,

 

I was wondering if someone could help guide me through how to filter my Comments Gallery by the selected project as my Comments gallery currently shows all Comments. My "Parent" list is a SharePoint list called 'Tool Design Support Requests'. My "Child" list is a SharePoint list called 'Tool Request Comments'. I can't figure out how to tie the two together. I created a LookUp column in the Comments SharePoint List that looks up to the TDSR SharePoint List attempting to tie them together with the Request Summary Title, but as you can see in the attached screenshot, the LookUp columns aren't populating. I'm happy to tie them together by SharePoint ID as well, but I don't know how to do that either. I've watched several tutorials, but none of them match my use case (e.g. they are done in Excel or have other key differences) so as someone new to Power Apps, the concept isn't clicking yet.

 

The only thing I have in my Items property for the Comments so far is Sort('Tool Request Comments',Modified,Descending). I've attached a screenshot of the gallery and form users use to add new comments to it. I'm 90% of the way there, I just need this all important piece.

 

Thank you!

Teresa

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks @tagustin2020 ,

I will still go with my original post concept - hide a card on the comment add/edit/view form (you did not show me this one) for the Field 'Parent ID' - I will refer to the form as frmComments below - change to your name.
When you select an item to display in any of the tabs, add this to the Gallery OnSelect.

Set(varID,Self.Selected.ID)

In the Default of the hidden 'Parent ID' Text Control on the Comments Form when you add or view/edit the comment.

If(
   frmComments.Mode=FormMode.New,
   varID,
   Parent.Default
)

Then the Items of your Comments gallery

Sort(
   Filter(
      'Tool Request Comments',
      'Parent ID'=varID
   ),
   Modified,
   Descending
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

12 REPLIES 12
WarrenBelz
Super User
Super User

Hi @tagustin2020 ,

You simply need a "common key" and probably the easiest (which I use) is having the ID number of the parent 'Tool Design Support Requests' in a field in 'Tool Request Comments'. I see you have a field 'Parent ID' in the list, but it is empty. If you had the number in there and (for instance) had the ID of the main form in a hidden field called txtID, your gallery Filter would be

Filter(
   'Tool Request Comments',
   'Parent ID' = Value(txtID.Text)
)

Is this what you are asking and I am not entirely clear?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Hello Warren, 

 

Thank you for responding to my question. I know you are somewhat familiar with my app at this point since you have helped me with a few other items, but I'll recap here for anyone else who might read the post.

 

My app has a home screen gallery, a new request form screen and an edit screen with four tabs. The gallery and all of the forms except for the the New Comment form and display gallery have 'Tool Design Support Requests' as the data source. I set up a variable on the nav arrow in the gallery so the app knows which record to pull up for each of the Edit forms (Request, Designer and Model Shop). Where I am stuck is how to have the Comment form know which record I wish to add a comment to so that the information displays correctly in the Comment gallery. I created a column in the Request Comments SharePoint List to capture a key to the 'Tool Design Support Requests' SharePoint list, but I don't know how to actually establish the connection. Can you help me understand that piece of it? Is there either a visible or hidden field I need to put in the Comments form to hook it up to the record they are trying to establish a connection to? That's where I get lost.

 

Thank you,

Teresa

Thanks @tagustin2020 ,

I will still go with my original post concept - hide a card on the comment add/edit/view form (you did not show me this one) for the Field 'Parent ID' - I will refer to the form as frmComments below - change to your name.
When you select an item to display in any of the tabs, add this to the Gallery OnSelect.

Set(varID,Self.Selected.ID)

In the Default of the hidden 'Parent ID' Text Control on the Comments Form when you add or view/edit the comment.

If(
   frmComments.Mode=FormMode.New,
   varID,
   Parent.Default
)

Then the Items of your Comments gallery

Sort(
   Filter(
      'Tool Request Comments',
      'Parent ID'=varID
   ),
   Modified,
   Descending
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi Warren,

 

Thanks for the advice. Unfortunately, I can't quite get it working yet. I've attached detailed notes and screenshots of what I tried in connection to your latest post. 

 

Kind regards,

Teresa

Hi @tagustin2020 ,

I do not have a lot of time at the moment, but you can set varID to varRecord.ID immediately after you set varRecord.

I will look at the rest a little later on.

Thank you so much Warren. That last step made everything fall into place. Just one more question. I am getting a delegation warning for my Gallery Items property formula, under the = sign (see screenshot). Do you know how I could rephrase the formula so this is not an issue? I expect we will have a lot of Comments so I don't want to run into display issues down the road. As you can see below, my goal is to have the most recent comments shown at the top of the gallery.

 

Sort(Filter('Tool Request Comments',ParentID=varRecord.ID),Modified,Descending)

 

Thanks again. I've been trying for so long to get this going without success, that I am very grateful for your help.

Teresa

Hi @tagustin2020 ,

I am assuming ParentID is a Numeric field in the list? This is quite strange. For a test, try this

With(
   {wID,varRecord.ID},
   Sort(
      Filter(
         'Tool Request Comments',
          ParentID=wID
      ),
      Modified,
      Descending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren,

 

The ParentID column is a single line of text field. The formula below is fully underlined in red when I copy paste it into the Items property of the Comments gallery and it is a no-go if I try to manually type it in. Intellisense won't even surface the name of the SharePoint List. I think PowerApps might be confused by wID. Is that a variable I need to set somewhere before proceeding to this step?

 

Teresa

Hi @tagustin2020 ,

This issue is the mismatch - two options

  1. Change the ParentID to Numeric (preferred) and the formula will work
  2. Use the below
With(
   {wID,Text(varRecord.ID)},
   Sort(
      Filter(
         'Tool Request Comments',
          ParentID=wID
      ),
      Modified,
      Descending
   )
)​

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,998)