Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Patch to a choice column in SPO

(0) ShareShare
ReportReport
Posted on by 257

I have a repeating table that adds the data to a collection, this collection then sends the data to a SPO list.  One of these fields is a Choice field in SPO.  This is my ForAll code

 

ForAll(
 OtherIn,
 If(
 (A1_Amount >= 1),
 (Patch(
 'GA-OtherInPage',
 Defaults('GA-OtherInPage'),
 {
 A1_Amountbeforetaxes_Clmn: A1_Amount,
 'A1_GST/HSTTotalPaid_Clmn': A1_GSTHST,
 'A1_PST/QSTTotalPaid_Clmn': A1_PSTQST,
 'A1_Project/Fund_Clmn': A1_ID,
 'A1_Project/Fundiption_Clmn': A1_Description,

 //A1_AccountCode_Clmn:{Value:A1_AccountCode}
 //A1_AccountCode_Clmn: A1_AccountCodeInput.Selected,

 A1_Locn_Clmn: A1_Loc,
 A1_Dept_Clmn: A1_Deprt,
 A1_DeptProg_Clmn: A1_DeprtProgramCode,
 FormID: First(
 Sort(
 'Master List Form',
 ID,
 Descending
 )
 ).ID
 }
 ))
 )
);

 

 

the issues is around the 

//A1_AccountCode_Clmn:{Value:A1_AccountCode}
//A1_AccountCode_Clmn: A1_AccountCodeInput.Selected,

 

all other fields get submitted correctly but this one.  In SPO the column it set to accept values manually, and in Power Apps its complaining about requiring a record vs text entry.  The Text value being the items in the collection. I've tried a few suggestions in from the forms but I think my code and method is a bit different from the solutions people have suggested.

 

Falling short of converting the SPO column to a text field and have the items pull from somewhere else, i would like to find a way to send this collection data to SPO.

 

Any help is appreciated.

  • Yock Profile Picture
    45 on at
    Re: Patch to a choice column in SPO

    sry answer late, it will patch success while choices items exist, patch nothing if not this choice

  • kilaj1 Profile Picture
    257 on at
    Re: Patch to a choice column in SPO

    wouldn't that explicitly patch it to choice 2?

  • kilaj1 Profile Picture
    257 on at
    Re: Patch to a choice column in SPO

    sorry for the delay.  I wasn't getting an error, it would write data back to SPO but it would duplicate the data to the first choice. 

     

    "will write the value in the Text field A1_AccountCode in the Collection OtherIn to a new record in the Choice"

     

    This got me thinking and I ended up changing the field type in SPO to a text field.  This fixed the issue, was a little annoying to go back and change all the patches i had but it worked in the end.  Thanks!

  • Yock Profile Picture
    45 on at
    Re: Patch to a choice column in SPO

    Yock_0-1659406818047.pngYock_1-1659406830482.pngYock_2-1659406845968.png

    Yock_3-1659406859964.png

    For my try is fine, that is go way to save data i think, every choice has items id.

    Yock_5-1659407364267.png

     

    Another good way is use choices function

     

  • WarrenBelz Profile Picture
    148,811 Most Valuable Professional on at
    Re: Patch to a choice column in SPO

    @kilaj1 ,

    We need to get down to basics here as the code

    A1_AccountCode_Clmn: {Value: aPatch.A1_AccountCode}

    will write the value in the Text field A1_AccountCode in the Collection OtherIn to a new record in the Choice Field A1_AccountCode_Clmn in the List 'GA-OtherInPage' providing: -

    • Those are the correct names for both the fields and the list and collection (I see OtherIncome mentioned)
    • The Choice field is a single choice in your list.

    Firstly, are you getting any error on the code or is it simply not writing the data ?

    Also can you please do what I asked before and post the column in your collection under View > Collections

  • kilaj1 Profile Picture
    257 on at
    Re: Patch to a choice column in SPO

    The code didn't work unfortunately, this is what's in the A1_AccountCode within the Collection

    kilaj1_0-1659013648560.png

    The SPO library, GA-Otherin, looks like this

    kilaj1_2-1659013919207.png

    This is the column in SPO where the data gets patch to

    kilaj1_1-1659013761170.png

     

     

     

  • WarrenBelz Profile Picture
    148,811 Most Valuable Professional on at
    Re: Patch to a choice column in SPO

    @Yock you are confusing a choice column with a lookup column

  • Yock Profile Picture
    45 on at
    Re: Patch to a choice column in SPO

    Actually the choices is a object type column, so if u want to save the choice type, u need to get items' choice number n choice text, it's the right way
    choice type like that:
    {

    choices num:
    choices text:

    }

  • WarrenBelz Profile Picture
    148,811 Most Valuable Professional on at
    Re: Patch to a choice column in SPO

    Hi @kilaj1 ,

    aPatch (you can call it whatever you want) is a disambiguation operator, which is probably not necessary, but I always use to make it clear that the value is coming from the Collection. If the code does not work, go to View > Collections > OtherIn (or is it GA-Otherin - please confirm) and see what is in the field A1_AccountCode

  • kilaj1 Profile Picture
    257 on at
    Re: Patch to a choice column in SPO

    Thanks for the reply, I will try that code out, "aPatch" is that new? never tried that before.

    A1_AccountCode_Clmn is a (single) Choice column in 'GA-OtherInPage'

    A1_AccountCode in OtherIn is a Text field

    Is any of this not true ?

    A1_AccountCode_Clmn is a single choice column in a SharePoint list

    A1_AccountCode, in the context of my code is from the collection GA-OtherIn

     

    When I tried a similar code in mine I got an error, "expected type record, found type error."

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1