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

automatically update field value

Hi All,

 

I created a PowerApps Application from a SharePoint List.  The list name is "Client Information" and in that list, I have a column named touch Point a Yes/No choice column.

 

Each row (or client) in my Application Gallery changes colour based on the value in the touch Point Column.

TemplateFill = If(ThisItem.'Touch Point'.Value= "Yes", RGBA(255, 0, 0, 1),RGBA(0, 255, 0, 1))


Now, I would like the value in touch Point to change when the user selects a client. For example, if the current value is Yes, I want the value to change to No. I tried Patch and UpdateIf but can't get to that result.

Can someone help me fix my formulas? 

 

OnSelect = If(ThisItem.'Touch Point'.Value="Yes",Patch('Client Information',ThisItem.'Touch Point',{'Touch Point': {Value:"No"}}))

 


Cheers,

Thebaz

 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hi @TheBaz 

Put an icon in the gallery and set its OnSelect property to 

UpdateContext({tp: !tp});
If(
    tp,
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "Yes"}
    ),
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "No"}
    )
)

 This will toggle the Touch Point from yes to no.  

View solution in original post

2 REPLIES 2
Super User II
Super User II

Hi @TheBaz 

Put an icon in the gallery and set its OnSelect property to 

UpdateContext({tp: !tp});
If(
    tp,
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "Yes"}
    ),
    Patch(
        'Client Information',
        ThisItem,
        {'Touch Point': "No"}
    )
)

 This will toggle the Touch Point from yes to no.  

View solution in original post

Thank you for your assistance. I ended up with this script, but I accepted your answer since it helped be aswell.

 

If(
ThisItem.'Touch Point'.Value = "No",
Patch(
'Client Information,'
BrowseGallery1.Selected,
{
'Touch Point': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "Yes"
}
}
),
Patch(
'Client Information',
BrowseGallery1.Selected,
{
'Touch Point': {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: "No"
}
}
)
)

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (29,425)