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

Change the Value of Complex Data Field Automatically

Hi,

 

I am trying to change the value of a complex data field (choice in Sharepoint) automatically with the press of a button in another screen. For example, if a student does not pass to the next grade the app would change the class of 2022 to class of 2023 (in highschool). Any suggestions? Thank you in advance.

4 REPLIES 4
RandyHayes
Super User
Super User

@ColaborativoPR 

Not sure of your entire scenario as you have not provided much in the line of details on what you have and how you are trying currently, but in general, the following formula should get you started:

Patch(yourDataSource, 
   {ID: yourRecordID,
    ChoiceColumnNameHere: {Value: 2023}
   }
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
ColaborativoPR
Regular Visitor

It definitely helps. But, I want to do something more standardized, like:

 

ChoiceColumNameHere: {Value: Value+1}

RandyHayes
Super User
Super User

@ColaborativoPR 

If you already have the record, then your formula can be:

Patch(yourDataSource, 
   {ID: yourRecord.ID,
    ChoiceColumnNameHere: {Value: yourRecord.ChoiceColumnNameHere.Value + 1}
   }
)

 

If for some reason you do not have the record (and you should to avoid another data lookup), the formula would be:

With(LookUp(yourDataSource, ID=recordID),  //or other criteria
    Patch(yourDataSource, 
        {ID: ID,
         ChoiceColumnNameHere: {Value: ChoiceColumnNameHere.Value + 1}
        }
    )
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
ColaborativoPR
Regular Visitor

This helps a lot. Thank you!

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,561)