cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
crjohnson82
Helper I
Helper I

Filter two forms using one Gallery

I am making a repeating table form. When an item is entered,  it creates and entry in the master list and multiple entrying in the detail list.

 

I would like to make another screen that shows a gallery ( MasterGallery) with two edit forms, that displays the editable items when MasterID = ID

 

I was able to display Gallery to Form1 using  MasterGallery.Selected, but I can't figure out a way to connect Form1 to Form2. 

 

Please Help....

18 REPLIES 18

Create another form right below that one (Copy/Paste) and set the DataSource (or Items honestly) to be the same function as before except make it Last(...) vs. First(...).  NOTE: This of course will only handle a 2-item list at the most.

BTW, you'll still need to do a SubmitForm(...) on each of your forms if changes are made.  I'd suggest a Disabled by default "Save" button that becomes active if any field's value is changed on any Form.  You can just submit all forms in that scenario (e.g. SubmitForm(Form1);SubmitForm(Form2)...)

Ok Thanks. I might have to look at the other option then.   I need it to have the capablitity to display at least 10. 

Yeah, you'd have to do some fancier sorting/popping of the list in order to do more than 2.  It can work that way, you just start needing to juggle the Collection variable a bit more.  The Gallery is the simplest way to handle an array of things that come up in that scenario (scroll bars, fit to size, etc.).  However, you could still do it using the method we just tried, we'd just need to get funky w/ our Filter for each list (e.g. Filter main list, grab first item, add first item to  Form1 and second list, filter main list + Not in 2nd list, add first item to Form2 and second list, later/rinse/repeat until main list is empty).

Hi @crjohnson82 ,

Do you want to display multiple Items from your second table within the Form2 (Edit form)?

 

If you want to display multiple Items from your second table within the Form2 (Edit form), I afraid that there is no way to achieve your needs in PowerApps currently.

The Edit form control in PowerApps could only be used to display single one record within your data source, it could not be used to display multiple items.

 

As an alternative solution, you could consider use a Gallery control to achieve your needs instead of the Form2. On your side, you could add a another Gallery within your screen, and configure it as Editable table.

I have made a test on my side, please take a try with the following workaround:

Add another Gallery within your app (instead of the Form2), then configure it as a Editable table. The screenshot as below:

  10.JPG

 

11.JPG

 

12.JPG

 

13.JPG

Set the Items property of the another Gallery to following:

Filter(secondDataTable, ID = Gallery.Selected.ID)

Add appropriate controls (e.g. Text Input controls, DatePicker, Toggle, ...) within above Gallery to list the column values in your second Data Table.

Add a "Check" icon within your Gallery, set the OnSelect property to following:

Patch(
secondDataTable,
ThisItem,
{
Column1: TextInput1.Text,
Column2: TextInput2.Text,
Column3: TextInput3.Text,
...
}
)

Add a "Remove" icon within your Gallery, set the OnSelect property to following:

Remove(secondDataTable, ThisItem)

The sample app, please check the attached .msapp file.

 

More details about configuring a Gallery as a Editable table, please check the following video:

https://www.youtube.com/watch?v=O2WqhRTUhyw

 

Please consider take a try with above solution, then 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.

@v-xida-msft.. Thanks for that. 

 

I had to put ThisItem.Selected in the patch formula for it to work.  But NOW when I save the changes made to the first form it creates duplicate entries in the secondDataTable (Gallery).  First form saves the changes w/o any duplicates.

 

I have a save button on the form b/c I have to make edits to the First Form also.

 

On the save button I have , OnSelect = SubmitForm(EditForm).

 

How do I prevent this?

 

Capture.PNG

 

 

Updated Info:

Patch(
secondDataTable,
       ThisItem.Selected,
       {
          Column1: TextInput1.Text,
          Column2: TextInput2.Text,
          Column3: TextInput3.Text,
          ...
       }
)

HI @crjohnson82 ,

Do you mean that it would create repeated reocrds within your secondDataTable when you save the changes within your first form?

Do you add other formulas within your app to create records in your secondDataTable when record is created/modifed in your MasterList data source?

 

Based on the issue that you mentioned, I suppose that you add other formulas within your app to create records in your secondDataTable or fire a flow (MS Flow) to create records in your secondDataTable when record is created/modifed in your MasterList data source.

Please check if you have added other formulas within your app to create records in your secondDataTable or fire a flow (MS Flow) to create records in your secondDataTable when record is created/modifed in your MasterList data source.

 

As an fixed solution, please consider re-create a new app based on your data source, then try above solution I provided, then check if the issue is solved.

Note: Please make sure that you do not design a flow (Microsoft Flow) to create records in your secondDataTable when record is created/modifed in your MasterList data source.

 

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.

Looks like i need to clear the collection before submitting.. That worked.. Thanks. 

@v-xida-msftThanks for the help. I really appeciate it.

 

After I got the second table working correctly, I added a delete icon, and used the below formula on OnSelect.

 

Remove('Requests',MasterGallery.Selected);RemoveIf(Details', TextInput5 = ID_DataCard2)

 

- TextInput5 is a format is a number (copied to the list, when the item is created)

- ID_DataCard2 (the number that was automatically created.)

 

It's giving me the error:  "Incompatible type: We can't evaluate you formula because the values being compared in the formula aren't the same type."

 

I am trying to select an item in the MasterGallery, and when I click delete, delete items in the EditForm and DetailGallery, if the TextInput ID (DetailGallery) =  ID_DataCard2 (EditForm).  

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,400)