cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

dropbox not holding the selection before patching multiple records

I have a collection of students based on a sharepoint list. I assign them host family based on a dropdown.  I patch the drop down details back to the SPlist and then refresh the collection.  All good.

 

However I am having issues with the dropdown selection holding the value selected.  I have the dropdown default as the following

If(IsBlank(ThisItem.HostFamily),"-",ThisItem.HostSearchHostTitle)
The first things is that even when the HostFamily column is blank the list still defaults to the first record in the list(which I do understand by default it will)
The second things is that when i select a new item it changes back to the default selection until I select the item again and it holds.  If I head to the next record and make a selection then before patching the previous record it also switches back to the default selection.  In effect I must select all items twice and patch each item one at a time.

 

If someone could help me I would appreciate it.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Hi @StuCundy 

 

If you have directly reference the dropdown items to datasource, in that case whenever you are doing a Patch operation, it is resetting the dropdown. In that case, you can use a variable to store the value and this variable can be used to patch the results.

 

Dropdown -> OnChange -> Set(SelectedDropdownOption, DropdownName.Selected)

 

In case you are looking for a bulk update operation, you can follow my blog (specifically step 11): https://www.appliedis.com/how-to-use-galleries-in-powerapps/

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted

Hi @yashag2255 

I spent the day on this yesterday and got a resolve.  Yes based on using a variable as you suggested I was able to old all selections on individual records in the gallery by patching to the collection the gallery is reading.  On change of the dropdown I patch the collection the HostTitle I select with the variable "SelectedHost".  I then patch a boolean field "HostUpdate" to be true

Set(SelectedHost, Dropdown1.SelectedText);
Patch(ColStudents,StudentBrowseGallery.Selected, {
    HostSearchHostTitle: SelectedHost.HostTitle,
    HostUpdate:true
    
})

 

After all the selections are done I use a for all patch to update the SP list and clear all HostUpdate fields to false.

ForAll(RenameColumns(Filter(ColStudents,HostUpdate=true),"ID","EID"),Patch(Students,LookUp(Students,ID=EID), {
    HostSearchHostTitle: HostSearchHostTitle,
    HostFamilyID:HostFamilyID
}));
ClearCollect(ColStudents,AddColumns(Filter(Students,GroupID=StudentsGroupDD.Selected.ID),"HostUpdate",false));

 

Thanks for the clarity

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User III
Dual Super User III

Hi @StuCundy 

 

If you have directly reference the dropdown items to datasource, in that case whenever you are doing a Patch operation, it is resetting the dropdown. In that case, you can use a variable to store the value and this variable can be used to patch the results.

 

Dropdown -> OnChange -> Set(SelectedDropdownOption, DropdownName.Selected)

 

In case you are looking for a bulk update operation, you can follow my blog (specifically step 11): https://www.appliedis.com/how-to-use-galleries-in-powerapps/

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted

Hi @yashag2255 

 

Thanks for your reply.  I was indeed making a patch on change of the dropdown which I have now removed and now I see the dropdowns are holding when selected.

I have made a variable based on the dropdown selection and I was able to use that variable to patch to the SPlist and make the change.  Obviously the variable is set for a specific record so I must save each record one by one as the variable will rest when I move to the next record in the gallery.  

 

However what I would like to be able to do is make make the dropdown selection on multiple items and then patch to the list.

 

I have read your blog which is great and do understand it, just trying to work it round to get my solution.

 

My gallery Items are taken from a collection "ColStudents"

So my dropdown Items come from a collection "ColHostList"  "HostTitle" is the field I am selecting.

So I think I need to create a dynamic collection of students who have had a host change, add to the collection each time I change a records host dropdown, then when I am finished click save to patch this collection to the splist and refresh my gallery to show the new data, clear the dynamic collection.

 

Does this sounds right?

 

 

 

Highlighted

Hi @yashag2255 

I spent the day on this yesterday and got a resolve.  Yes based on using a variable as you suggested I was able to old all selections on individual records in the gallery by patching to the collection the gallery is reading.  On change of the dropdown I patch the collection the HostTitle I select with the variable "SelectedHost".  I then patch a boolean field "HostUpdate" to be true

Set(SelectedHost, Dropdown1.SelectedText);
Patch(ColStudents,StudentBrowseGallery.Selected, {
    HostSearchHostTitle: SelectedHost.HostTitle,
    HostUpdate:true
    
})

 

After all the selections are done I use a for all patch to update the SP list and clear all HostUpdate fields to false.

ForAll(RenameColumns(Filter(ColStudents,HostUpdate=true),"ID","EID"),Patch(Students,LookUp(Students,ID=EID), {
    HostSearchHostTitle: HostSearchHostTitle,
    HostFamilyID:HostFamilyID
}));
ClearCollect(ColStudents,AddColumns(Filter(Students,GroupID=StudentsGroupDD.Selected.ID),"HostUpdate",false));

 

Thanks for the clarity

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,430)