Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

How to filter the gallery multiple rows data in a repeating table?



I created repeating table like infopath in powerapp but all the records showing from the SQL table on each submitted form. I want to show the repeating table records if the record is submitted from the same form. I am using primary and foreign key relation in SQL [dbo].[ContractInformation](ID is primary key) and [dbo].[IncidentReport](IncidentReport_ID which is the foreign key of IncidentReport table).


Can anyone please help out in this, how I can apply filter?

Super User
Super User

Hi @pkumar,
Have you not tried using filter function on your datasource that you using for your gallery control.

Community Champion
Community Champion



A repeating table in PowerApps, a "sub-table" is usually abstracted into two Galleries. The first gallery is your main Gallery where Items refers to your main table. The second Gallery's Items usually is a Filter on the selected item from the first table, this becomes your "sub-table". 


Each example would be a little different, but the above is a high level overview of one way you could approach it.


@pkumar Do you have two Galleries for starters? You would apply the filter on the second one, or "sub-table" based on selected item from the first Gallery, or main table.

Hello @poweractivate ,


I already applied filter but on the item selection, I have selected the collect name which is allowing me to insert the data into the SQL on item functions. I try to use add the filter  on item functions filter is working fine. But it is not get working If I am applying the filter collection name  and filter statement on item function. 

ContractInformation, Filter('[dbo].[ContractInformation]', Text(IncidentReport_ID) = DataCardValue5.Text)


If I am applying data source name ('[dbo].[ContractInformation]'. Then filter is working fine but I am not able add a new row in the Gallery.

Can you please advise?

@DeepakS  I have tried the filter function on data source. It is working. But is is not allowing to add a new row in the gallery. I want to achieve here repeating table like infopath.

Community Support
Community Support

Hi @pkumar ,


Could you share more details with your repeating table and data source? What is the data source of repeating table (gallery)?

Do you mean you want the repeating table(gallery) to only show the records you just add?

I think you can add a filter condition that shows records that the ID column is lager than current maximum ID value when you start edit repeating table, that means at the beginning of edit, the repeating table is empty, once you add a new row, it will be shown in the table because the ID is larger.

1.  Save the current maximum ID value to Variable when you start to edit the repeating table

Set(CurrentMaxID, Max([dbo].[ContractInformation],ID)) 

2.  Items property of repeating table(gallery):

Filter([dbo].[ContractInformation], ID>CurrentMaxID)



Hi @poweractivate 

I am able to submit the form and update the form on SharePoint. But I am not able to add a new row on the repeating table if the form is open in edit mode. I added the form filter on repeating table Edit item:

Filter(ContractInformation, Fk_IR = BrowseList.Selected.ID)


Edit form OnSuccess

UpdateIf(ContractInformation, Gallery1.Selected.ID =ID,
    ContractName: TextInput1.Text, 
    Position: TextInput2.Text, 
    CompanyName: TextInput3.Text,
    ContactNumber: TextInput5.Text


To add a new row

Patch(ContractInformation, ThisItem, {ContractName: TextInput1.Text, Position: TextInput3.Text,CompanyName: TextInput2.Text,ContactNumber: TextInput5.Text}); Collect(ContractInfo,{ContractName: "", CompanyName: "", Position:"", ContactNumber:""});

Can you guys please help out in this? How I can resolve this issue? 

Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,208)