I have a gallery that returns multiple rows. The gallery's datasource is a Collection based on a table that has a column of datatype = Choice with multiple select allowed.
I have multiple pages in my app with Back and Next buttons.
When I select choices in the combo box it patches correctly, but if I click Next and go to the next page, and then click Back to go back to the page with the gallery, the values in the multiple select combo box are blank/cleared. Same also happens if I open the form from the beginning and it needs to return the multiple selected values for the gallery.
Setting DefaultSelectedItems = ThisItem.Blah doesn't work as it seems to return the value of the selected row (usually the last row) for all rows. (Is this a bug as the same doesn't happen for any other control type?)
I think I need a way to loop through gallery rows and set the value manually. I've tried looping through the gallery but I'm not sure if I did it correctly but also I'm not sure where to do it. Screen OnVisible seems to run before DefaultedSelectedItems so I can't use that.
In summary, I need help on populating the DefaultSelectedItem of a multiple select combo box in a Gallery. Thanks.
Hi @gabrielaurora,
What exactly is being patched when making changes in the selection?
If it is the table on which the collection in based, do you make sure to also update the collection?
In case it is the collection, could it be that the collection is being populated in the OnVisible property of the screen, basically overwriting the changes that were made?
For any scenario I would consider if a collection is really needed since it can cause the described issues. It may be better to connect directly to your table.
Thanks for the reply. I originally did base it on the table but got this issue and found a suggestion to use a collection in galleries as they are more stable, but the issue still happened either way.
I actually didn't explain myself correctly in the original post. I said that when I go back to the page the values are clear/blank but that's not correct.
If I set DefaultSelectedItems to ThisItem.Blah (as your meant to) when I patch the data and the gallery is refreshed (this is done automatically, I don't do a refresh) or move to a different page then come back, the values are set to the values of the last row.
For example, say I have 2 rows and I set the multiple select to A and B in the first row and C and D in the second row, after patching or moving page and coming back, the multiple select for both rows are C and D, even though the data patched correctly and the database shows A and B for the first row and C and D for the second. So to me setting DefaultSelectedItems to ThisItem.Blah is not working correctly, and this is my main issue.
It's just an issue for the multiple select combobox as I have other controls in the gallery with DefaultSelectedItems = ThisItem.Blah that all work fine. I've tried the same field in a Form and it works fine, it just has a problem in a Gallery.
I have googled extensively and cannot find a single example of multiselect in a gallery so I'm beginning to think it can't be done.
Hi @gabrielaurora ,
I think the issue may be in a misunderstanding of how collections work:
They are very similar to variables, meaning they keep their value from the moment you set them until you make a change to them. In your case I don't think you are updating your collection after you have updated your data source. This means that when you navigate to another screen and back, the gallery will reset and the (non updated) values from the collection are displayed.
To resolve this, you will need to update your collection after making changes to the data source or get rid of using the collection altogether.
Thanks again for the reply.
Ok, I've been working late nights on this and have been trying many things and the actual issue is slightly different to my previous posts (again... 😬) I removed DefaultSelectedItems = ThisItem.Blah for testing which was causing the blank fields, but I've just re-added it and this is what's actually happening:
1. Data already exists in the table (from a previous session)
2. On navigate to the page with the multiple select combobox, Screen OnVisible creates a collection using ClearCollect.
3. The data in the gallery, including the multiple select combobox, populates correctly, so ThisItem.DefaultSelectItems is working fine (not like I stated earlier that it wasn't)
4. For all fields in the gallery other than the multiple select comboboxes, I patch the data on the back and next buttons.
5. For the multiple select combobox, I patch on OnChange using a ForLoop to get all the selected values in the multiple select combobox, using this code:
ForAll(
comboBusinessAreasList.SelectedItems,
Collect(
colBusinessAreas,
{
Value: ThisRecord.Value
}
)
);
Patch(BlahTable, ThisItem, {BusinessAreasList:colBusinessAreas.Value}
);
ClearCollect
(colBusinessAreas, Blank());
6. If I navigate away from the page and back to it the values are all fine. So I assume Screen OnVisible is doing it's job and getting the latest values.
7. Now if I update a value in a different control which gets patched on back and next buttons, when I navigate away and then back to this page, the multiple select combobox of the first row loses it's value.
E.g.
This is the current values:
I update FTE of the second row to 3. I patch the values and navigate away. I return and the multiple select combobox for the first row has been cleared:
I'm not sure what could be causing this.
Hi @gabrielaurora ,
Try changing the OnChange property of the Combobox to:
Patch(
BlahTable,
ThisItem,
{BusinessAreasList: Self.SelectedItems}
);
That patched the values (saves me doing the for loop) but I still have the issue. But I think you're on the right track.
I remember when trying a hundred things, I did notice that patching the other controls OnChange had a similar effect with clearing the top row, which is why I put the patch on the back/next button. I didn't patch the combobox as I thought I had to loop. This is my code in the back/next buttons that patches all rows and controls (except the combobox) in the gallery:
ForAll(
Gallery_1.AllItems
As memNew,
Patch(
BlahTable,
{
Col1:memNew.txtCol1.Text
,Col2:memNew.ddCol2.Selected.Value
etc.
}
)
);
Navigate('BP Section 4b')
Would you know if I can patch the combobox in the above code? E.g:
ForAll(
Gallery_1.AllItems
As memNew,
Patch(
BlahTable,
{
Col1:memNew.txtCol1.Text
,Col2:memNew.ddCol2.Selected.Value
,BusinessAreasList:memNew.comboboxBusinessAreasList.??
}
)
);
Navigate('BP Section 4b')
I tried Self.SelectedItems was bad syntax.
This BusinessAreasList:memNew.comboBusinessAreasList.SelectedItems patches fine but then still have the issue when I navigate away and then comeback that the first row of the combobox clears.
It's 2 am here so tomorrow I'll take a screen recording of what's happening if that will help make more sense.
Hi @gabrielaurora ,
Try adding one extra line to the navigations button's OnSelect property to update the collection after patching the data source:
ForAll(
Gallery_1.AllItems
As memNew,
Patch(
BlahTable,
{
Col1:memNew.txtCol1.Text
,Col2:memNew.ddCol2.Selected.Value
etc.
}
)
);
ClearCollect(CollectionName, BlahTable);
Navigate('BP Section 4b')
Replace CollectionName with the actual name of the collection.
Ps. I still think you don't actually need to use a collection and connecting the gallery directly to the datasource would fix all your issues. However, the above should fix the issue whilst continuing the use of a collection.
I tried both of those things and still no joy. I'm changing the screen to use a form now instead of a gallery which will sort my issue but for completeness I've attached a powerpoint with a video of what's happening and what I can't solve.
To clarify the video, when I go to the screen the first time, the data in the multi select comb box is correct. If I update the combox box, click next (patch) and go back, data is fine.
When I update any other field other than the combo box (I call it second field in the video) when I click next (patch) and go back, the data in the combo box for the first row is cleared. Note, the data was patched correctly in the database table it's just displayed incorrectly.
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08 23 @WarrenBelz 31 @DBO_DV 10 @Amik 19 AmínAA 6 @mmbr1606 12 @rzuber 4 @happyume 7 @Giraldoj 3@ANB 6 (tie) @SpongYe 6 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08 10@WarrenBelz 25 @DBO_DV 6@mmbr1606 14 @AmínAA 4 @Amik 12 @royg 3 @ANB 10 @AllanDeCastro 2 @SunilPashikanti 5 @Michaelfp 2 @FLMike 5 @eduardo_izzo 2 Meekou 2 @rzuber 2 @Velegandla 2 @PowerPlatform-P 2 @Micaiah 2 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8 SunilPashikanti8
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages