cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dyee4613
Helper V
Helper V

Gallery Duplicating Questions

I have an app that uses 4 galleries to store my questions. 

 

Here is how I set it up:

The "OnVisible" for each page has my collection.  This contains all my questions. 

 

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Ans:""},
{Q_ID: 48, Q_Type:"Bedrooms",Q_Desc:"Floor Covering", Ans:""},

etc..etc...

 

The gallery's item quality is set to this collection.  The on select patches the value to the answer.

 

Patch(Bedroom, ThisItem, {Ans:Radio1_5.SelectedText.Value})

 

When the user is done, the submit button creates a collection with all the data from all the tabs filled out (bedroom, bathroom, kitchen, etc).  

 

Problem: When you switch tabs, then return to the original tab the questions double.  For example, if I went from the bedroom to the bathroom, to the bedroom, I will now have 20 questions (the same 10 twice).  I was able to eliminate this with the home button by adding a clear(Bedroom) everytime they press home.  However, I need the data from all sections so I can't do a clear from moving from the bedroom to the bathroom.  Any ideas?  

1 ACCEPTED SOLUTION

Accepted Solutions
dyee4613
Helper V
Helper V

I think I figured it out.  I'll delete the other tabs and put all the data on one tab.  I'll switch the navigation bar to a filter and I'll just filter to whatever section they want.  

View solution in original post

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @dyee4613 ,

Do you want to solve the problem about repeating creation of collections?

I recommend you try the function of ClearCollect.

For example, set the bedroom's Screen's Onvisible:

ClearCollect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Ans:""},
{Q_ID: 48, Q_Type:"Bedrooms",Q_Desc:"Floor Covering", Ans:""},

When you come back to bedroom Screen, the collection will be rebuilt and the data is as same as original collection.

Here's a doc about ClearCollect for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clear-collect-clearc...

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@v-yutliu-msft 

 

Thanks for the solution!  Unfortunately, this won't work for my app.  I thought about doing this when I added the clear when users click home.  The user needs to see what they entered in each tab and clearcollect won't show that.  Can you explain what's causing the gallery to duplicate every time I leave the page?

 

Edit: I tried clearcollect + Load data, this doesn't work either because it just adds it to the bottom of my questions

dyee4613
Helper V
Helper V

I think I figured it out.  I'll delete the other tabs and put all the data on one tab.  I'll switch the navigation bar to a filter and I'll just filter to whatever section they want.  

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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