web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch a choice column ...
Power Apps
Answered

Patch a choice column from a collection (Repeating table)

(0) ShareShare
ReportReport
Posted on by 197

Hi all,

 

I have made an app with a repeating table. In the repeating table i have 5 text column and 1 choice column. After every row i use this code and works fine: 

 

Patch(ProjectCollection, ThisItem, {LineProject: inputProject.Text, LineCustomer: inputCustomers.Selected.Value}); Collect(ProjectCollection, {LineProject: "", LineCustomer: ""})

After every new row, i can see the values in the collection. When i want to patch the column to send the info the SharePoint i get an error. 

ForAll(ProjectCollection, If(!IsBlank(LineProject), Patch(Projecten, Defaults(Projecten), {Title: LineProject, Customer: LineCustomer ,MasterID: Form1.LastSubmit.Id})))


 Name of the dropdown: inputCustomers. I saw this topic but the solution doens't work for me. 

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/ClearCollect-a-choice-field/m-p/363140

Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I have a couple questions for you.

     

    1.  In the dropdown are the choices defined in the items attribute or are you getting them from outside of the App?

    2.  What is the error you are getting?

    3.  What is the field type of the SharePoint field where the data is going?

  • WackdeMack Profile Picture
    197 on at

    1. Inside the app, you can choose the value. After this, i see the correct values in the collection.

    2.  Powerapps the type of this argument does not match the expected type record. Found type 'Text'.

    3. What is the field type of the SharePoint field where the data is going? Single select choice column

     

    So the issue is about text to choice column

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    So that is a very different and much more difficult issue.   Because it's a choice column in SharePoint you can't patch it the same way you do other fields.

     

    I recommend this video.    https://www.youtube.com/watch?v=gsk14D-CYRE

  • WackdeMack Profile Picture
    197 on at

    Awesome! I guess it will work with this video 🙂 

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Good luck!   I hope that works for you.

  • WackdeMack Profile Picture
    197 on at

    If i change my patch code to this, i can patch the value to SharePoint but now i get every time on the select value from row 1. That's why i send it first to the collection. After this i need it to send to SharePoint.

     

    atch(Projecten, Defaults(Projecten), {Title: LineProject, Customers: inputCustomer.Selected (Name of the dropdown instead name of the column from the collection) ,MasterID: Form1.LastSubmit.Id}))

    Hopefully can is see this in the video 

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I don't know if this will help at all or if it doesn't matter, but in your patch screenshot you have an extra space between Customers: inputCustomer.Selected and the comma between it and the next item.

     

    Customers: inputCustomer.Selected , MasterID

    Customers: LineCustomer ,MasterID

     

    I know this is a real long shot, but try moving that comma.   Customers: LineCustomer,MasterID

     

    I am thinking it might somehow be adding a space at the end of the value and that is making it not match the item in your SharePoint field.

  • WackdeMack Profile Picture
    197 on at

    Didn't work. I know the patch is fine for all the text column. I will search the forum and YouTube for a solution.

     

    I know for sure that there are many people use createcollection for a choice column. I see the tha collection is correct filled in, thats step 1 🙂 Now the export to SharePoint. 

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @WackdeMack ,

    Could you please share a bit more about the 'Customer' field in your SP List? Is it a Choice type column?

     

    If the 'Customer' field in your SP List is a Choice type column, please consider modify your ForAll formula as below:

    ForAll(
     ProjectCollection, 
     If(
     !IsBlank(LineProject), 
     Patch(
     Projecten, 
     Defaults(Projecten), 
     {
     Title: LineProject, 
     Customer: { // Modify formula here
     Value: LineCustomer
     },
     MasterID: Form1.LastSubmit.Id
     }
     )
     )
    )

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • WackdeMack Profile Picture
    197 on at

    Thanks! Never thought this was the solution. Very happy with the result.

     

    I have one question about the start screen. I have a button, new project and use a collection to start.

     

     

    ClearCollect(ProjectCollection, {LineProject: "", LineCustomer: "", etc})

     

    Is the start code for the choice column good, the same as text? Because for a number column, you use LineNumber: 0)

    Doubt if my start value for the choice column is correct. After i add a new line, the it takes the last value from the last line.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 604

#3
11manish Profile Picture

11manish 518

Last 30 days Overall leaderboard