cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lnelsen
Frequent Visitor

Patch Multiple Columns in SharePoint List

I have an app that has been working perfectly using the sliders using this patch when submitting the form: 

 

Patch('SPListName', Defaults('SPListName'), {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName, Column1: Slider1.Value, Column2: Slider2.Value, Column3: Slider3.Value});
Reset(Slider1); Reset(Slider2); Reset(Slider3);
Set(varScan, Blank());
Navigate(HomeScreen)

 

Screen Shot 2022-10-28 at 3.03.22 PM.png

 

I am wanting to change the sliders to individual buttons with the selected button populating the column. I tried placing the buttons for the column in a container and tried this patch:

 

Patch('SPListName', Defaults('SPListName'), {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName, Column1: Column1Container.Value});
Set(varScan, Blank());
Navigate(HomeScreen)

 

Screen Shot 2022-10-28 at 11.11.10 AM.png

Any advice would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Waegemma
Super User
Super User

Hi Inelse,

 

Since you work with sliders, I presume these values:

 

0 = Intervene

1 = Acceptable

2 = Independent

 

OnVisible property of the Screen:

 

// Setting values to standard value 1, Acceptable

UpdateContext({
 _category1: 1, // Preparation & Knowledge
 _category2: 1, // Clinical Skills
 -category3: 1}) // Time Management

 

 

Per categoryname (Preparation&Knowledge; Clinical Skills, Time Management) you have three buttons:

 

In the OnSelect of the Buttons: (example here: category1, just adapt for category2 and category3)

 

Button Intervene:

UpdateContext({_category1:0})

Button Acceptable:

UpdateContext({_category1:1})

Button Independent

UpdateContext({_category1:2})

 

 

BorderThickness Button (to indicate which one is selected):

 

Button Intervene:
If(_category1 = 0, 2, 0)

Button Acceptable:
If(_category1 = 1, 2, 0)

Button Independent
If(_category1 = 2, 2, 0)

 

 

Your Patch function:

 

Patch('SPListName', 
       Defaults('SPListName'), 
      {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName,
       Column1: _category1, Column2: _category2, Column3: _category3});

// Reset to standard value
UpdateContext({_category1:1, _category2:1, _category3:1})

 

 

Hope this helps,

 

Marc

View solution in original post

5 REPLIES 5
Waegemma
Super User
Super User

Hi Inelse,

 

Since you work with sliders, I presume these values:

 

0 = Intervene

1 = Acceptable

2 = Independent

 

OnVisible property of the Screen:

 

// Setting values to standard value 1, Acceptable

UpdateContext({
 _category1: 1, // Preparation & Knowledge
 _category2: 1, // Clinical Skills
 -category3: 1}) // Time Management

 

 

Per categoryname (Preparation&Knowledge; Clinical Skills, Time Management) you have three buttons:

 

In the OnSelect of the Buttons: (example here: category1, just adapt for category2 and category3)

 

Button Intervene:

UpdateContext({_category1:0})

Button Acceptable:

UpdateContext({_category1:1})

Button Independent

UpdateContext({_category1:2})

 

 

BorderThickness Button (to indicate which one is selected):

 

Button Intervene:
If(_category1 = 0, 2, 0)

Button Acceptable:
If(_category1 = 1, 2, 0)

Button Independent
If(_category1 = 2, 2, 0)

 

 

Your Patch function:

 

Patch('SPListName', 
       Defaults('SPListName'), 
      {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName,
       Column1: _category1, Column2: _category2, Column3: _category3});

// Reset to standard value
UpdateContext({_category1:1, _category2:1, _category3:1})

 

 

Hope this helps,

 

Marc

Tried this-

 

OnVisible property of the screen:

            UpdateContext({_category1:2,

_category2:2,

_category3:2})

 

In the OnSelect of each button:

            UpdateContext({_category1:1}) and so forth…

 

In the BorderThickness for each button. I wanted it to be a little thicker. Which it does, however, it doesn’t do it when you select the button, it does it for the last item when you select the next item.

            If(_category1 = 1, 10, 0)

 

Patch function:

Patch('SPListName’, Defaults(‘SPListName’), {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName, Column1:_category1, Column2:_category2, Column3:_category3, Comments:CommentInput.Text});

Set(varScan, Blank());

UpdateContext({_category1:2, _category2:2, _category3:2});

Navigate(HomeScreen)

 

If I take out the Column information everything else populates the SP list. As is, it doesn’t allow me to submit.

lnelsen
Frequent Visitor

Button selection BorderThickness resolved - moved to FocusBorderThickness.

I modified the patch to this and it works! Thanks for pointing me in the right direction.

 

Patch function:

Patch('SPListName’, Defaults(‘SPListName’), {BarcodeScanned:varScan, WhenScanned:Now(), WhoScanned:User().FullName, Column1:Value(_category1), Column2:Value(_category2), Column3:Value(_category3), Comments:CommentInput.Text});

Set(varScan, Blank());

UpdateContext({_category1:2, _category2:2, _category3:2});

Navigate(HomeScreen)

Waegemma
Super User
Super User

Hi @lnelsen ,

 

Good job!  

 

Marc

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,563)