@RandyHayes wrote:
@v-xida-msftthanks for re-explaining the solution that I provided with my example app.
@Anonymous
The error in the alternate duplicate solution provided will still be with the value
NUMBERColumn: Value(Gallery1.Selected.ButtonText)
Also, this will yield improper results as the formula suggested by @v-xida-msft references Gallery1.Selected. The premise of what you are doing is to have only a single item "selected". If a user clicks on another button without "clearing" the first one, then the formula provided will have incorrect results as the Selected item has now changed.
Instead you will want to replace the Gallery1.Selected with Lookup(Gallery1.AllItems, selected).button (working with the names from my sample app where we used selected and button)
Also, as I mentioned in the original solution response...
As for your Patch statement. All is good there except the Number value. If you are getting the information from a Choice column, then you will really only have values. If you have another source for the number values (such as a lookup), then this is easily added in.
The above formula will have a result of 0 since your button text is a string that is non-numeric. If you need values for your buttons (numeric), then I would suggest putting them into your Items definition for the Gallery
Also - Wasn't entirely clear from your original question if you wanted the users to be forced to "Unselect" a button before choosing another, or if they could choose any button regardless.
I've provided another sample app that properly demonstrates the use of the numeric value in your choices. Also, I've accounted for the ability for a user to select any button they want, or to be forced to unselect the current button in order to choose another. (In PowerApps, Create and App or Open an existing App, then File->Open->Browse for downloaded file).
Key areas to look at in the app:
App - OnStart
Gallery1 - Items, OnSelect
Button1 - Fill, HoverFill
HtmlText1 - HtmlText
I hope this is clearer for you and helpful.
Thankyou for this,
However i dont think i explained myself very well, however after playing around with the app ill show you what i mean, ive left your example with the yellow fill and im using two gallery's below, one is called DumpGallery and the other called PitGallery. With buttons named Dumpbutton and Pitbutton,

Both these new collections are loaded via the onstartapp:
ClearCollect(
buttonList,
{button:"SR1", value:1, selected:false},
{button:"SR2", value:2, selected:false},
{button:"LM1", value:3, selected:false},
{button:"LM2", value:4, selected:false},
{button:"LM3", value:5, selected:false},
{button:"SRE", value:6, selected:false})
;
ClearCollect(
PitList,
{PitBut: {Value : "LM1"}, selected:false},
{PitBut: {Value : "LM2"}, selected:false},
{PitBut: {Value : "LM3"}, selected:false},
{PitBut: {Value : "SR1"}, selected:false},
{PitBut: {Value : "SR2"}, selected:false},
{PitBut: {Value : "SRE"}, selected:false})
;
ClearCollect(
ButtonCollection,
{ButtonText: "North Dump", IsClicked: false},
{ButtonText: "South Dump", IsClicked: false},
{ButtonText: "East Dump", IsClicked: false},
{ButtonText: "West Dump", IsClicked: false}
);
Set(CurrentButtonText, Blank());However i am not able to get any of these buttons to patch into the sharepoint list (i made everything a choice column for convience)
So i want when say the button LM1 is selected to send LM1 value into a choice column on sharepoint and if i want have the North Dump and LM1 and other buttons selected the onselect of the tic sends them all to sharepoint together?
I think its probably easier to show the patch code
If(
Connection.Connected,
Patch(
'Haulage Log',
Defaults('Haulage Log'),
{
Pit: {Value: Gallery1.Selected.Button1},
'Dump Location: {Value: DumpGallery.Selected.DumpButton}
}
),
Collect(
TESTCOLLECTION,
{
Pit: {Value: Gallery1.Selected.Button1} ,
'Dump Location: {Value: DumpGallery.Selected.DumpButton}
}
)
);
Navigate(Screen1, ScreenTransition.None)the error i get when i try to patch is as follows,
the value column in the data source your updating expects a text type and your using a control type
Also i can not for the life of me figure out why i cant copy and paste your html code and change the gallery etc and for it to work. (i take it, the patch functions patches the html not the gallery? or am i confused)