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

Gallery Repeating Collection

Hi.  I have an app with multiple pages and each page has a collection on it.  For each page, the onload has a formula similar to this

 

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Opt1:"Clean/OK", Opt2:"Dirty", Opt3:"Damaged", Opt4: "Repair/Replace", Opt5: "N/A", Ans:""},

 

I take collection and plug it into the item section for a gallery.  The gallery lists all the questions I want but then it repeats them two additional times.  How can I eliminate this excessive duplication?

1 ACCEPTED SOLUTION

Accepted Solutions
KroonOfficeSol
Resident Rockstar
Resident Rockstar

@dyee4613 

 

First, your logic looks strange to me. This because you have options as columns, were I would expect the option columns are options a person should be able to pick from a combo/dropdown control. I would expect your gallery to be like:

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Ans:ComboBox.Selected.Option})

And on the Combo.Items you use a table() formula like

Table({Opt:"Clean/OK"}, {Opt:"Dirty"}, {Opt:"Damaged"}, {Opt: "Repair/Replace"}, {Opt: "N/A"})

But then why would you collect it on Screen.OnVisible and not on a SubmitButton.OnSelect?

 

But still you should have just one record added if your formula is correct. I noticed an error and It should be like this:

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Opt1:"Clean/OK", Opt2:"Dirty", Opt3:"Damaged", Opt4: "Repair/Replace", Opt5: "N/A", Ans:""})

If you then still get duplicates then comment the formula out on this place, go away from the screen en re-enter. See if you got a record added now. If so there is a collect() formula already somewhere else.

 

Hope this helps,

 

Paul

View solution in original post

3 REPLIES 3
KroonOfficeSol
Resident Rockstar
Resident Rockstar

@dyee4613 

 

First, your logic looks strange to me. This because you have options as columns, were I would expect the option columns are options a person should be able to pick from a combo/dropdown control. I would expect your gallery to be like:

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Ans:ComboBox.Selected.Option})

And on the Combo.Items you use a table() formula like

Table({Opt:"Clean/OK"}, {Opt:"Dirty"}, {Opt:"Damaged"}, {Opt: "Repair/Replace"}, {Opt: "N/A"})

But then why would you collect it on Screen.OnVisible and not on a SubmitButton.OnSelect?

 

But still you should have just one record added if your formula is correct. I noticed an error and It should be like this:

Collect(Bedroom,
{Q_ID: 47, Q_Type:"Bedrooms",Q_Desc:"Walls and Ceiling", Opt1:"Clean/OK", Opt2:"Dirty", Opt3:"Damaged", Opt4: "Repair/Replace", Opt5: "N/A", Ans:""})

If you then still get duplicates then comment the formula out on this place, go away from the screen en re-enter. See if you got a record added now. If so there is a collect() formula already somewhere else.

 

Hope this helps,

 

Paul

View solution in original post

@AnonymousThank you!  Your suggestion worked.  I think I initally had the extra text there because I wanted the flexibility to modify radio options but they all ended up being the same so it is unnecessary.  I removed them and it eliminated the duplication.

 

I tried Ans: combobox.selected.option but for some reason this didn't work for me.  I ended up doing a patch on select to fill in the answer.

@dyee4613 

 

ComboBox.Selected.Option was just an example. After ComboBox.Selected. you chose the value you want to return. It the table example this would be .Opt. 

 

It good to know that:

ComboBox.Selected.YourField // returns a string
ComboBox.SelectedItems.YouField // returns a list/array
ComboBox.SelectedItems // Returns a list of objects/records

For a Radio button you should use YourRadio.Selected.Field

 

Good Luck,

 

Paul

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (995)