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 / Patching multiselect c...
Power Apps
Answered

Patching multiselect choice one choice at the time!

(0) ShareShare
ReportReport
Posted on by 169

I have an app that's connected to a SP list.

One of the columns in the list is a choice column for "Package type".

In the App there is a dropdown to choose the packages, and multi-select is On.

When patching the form, the multi-selected choices got patched together! for example, if the user selected pckg1 & pckg2, I'm getting 2 entries and in the value of the choices columns I'm getting both!

How to make them patch the 1st choice in the 1st entry and the 2nd choice in the 2nd entry?

 

P.S.:

  • I tried to patch the DataCardValue & tried the comboBox both gave me the same results 😞 
  • Using DataCardValue.Selected.Value gave me errors

Code:-

With(
 {
 wDays: AddColumns(
 ComboBox1_1.SelectedItems,
 "AddDays",
 Value(Span)
 ),
 wDate: Now()
 },
 ForAll(
 //DataCardValue25_1.SelectedItems,
 ComboBox2.SelectedItems,
 ForAll(
 DataCardValue4_1.SelectedItems,
 ForAll(
 wDays,
 Patch(
 'Products List',
 Defaults('Products List'),
 {
 'Product Code': Value(DataCardValue26_1.Text),
 'Package type':ComboBox2.SelectedItems,
 Title: DataCardValue11_1.Text,
 'Batch No.': 'BNO DATACARD'.Text,
 'Samples Description': DataCardValue14_1.Text,
 'Stability Conditions': DataCardValue4_1.SelectedItems,
 'No. of samples': Value(DataCardValue13_1.Text),
 Location: DataCardValue33_1.Text,
 'Incubation Date': wDate,
 EditProp: true,
 'Stability Interval': Period,
 'Expected Withdrawal date': DateAdd(
 wDate,
 AddDays,
 TimeUnit.Days
 ),
 'Stability Period': DateAdd(
 wDate,
 AddDays,
 TimeUnit.Days
 )
 }
 )
 )
 )
 )
);
Navigate(
 SuccessScreen,
 ScreenTransition.Fade
);
NewForm(Form1_1)

 

Categories:
I have the same question (0)
  • Verified answer
    Cat Schneider Profile Picture
    488 Most Valuable Professional on at

    Is there a reason why you need multiple rows of all the same data for a Choice column that could have multiple values, but you only want one of those selected choices per row? I think I said that right. No judgement here, because I understand there's plenty of use cases for things I know nothing about; I'm just trying to understand your request so I can help.

    If anything you could potentially do a patch using a ForAll statement:

     

    ForAll(DataCardValue_Choices.SelectedItems As i,
     Patch(DataSourceName, Defaults(DataSourceName), {Field1: DataCard_Field1.Update, ChoicesField: Table({Value: i.Value}), OtherFields: DataCard_OtherFields.Update});
    )

     

    I realize now that this might be an over-simplified explanation, and if so, I apologize. If necessary, I can go into more detail in a few hours after I get some sleep.

  • amralomari Profile Picture
    169 on at

    Thanks a lot!

  • amralomari Profile Picture
    169 on at

    Hi dear @CatSchneider 

    After implementing the code successfully for a while, I've started getting patch error "Network error when using patch function : The requested operation is invalid"

    I've tried a lot of things to troubleshoot it but with no luck :S 
    Would you mind taking a look at it?


     

    With(
     {
     wDays: AddColumns(
     ComboBox3.SelectedItems,
     "AddDays",
     Value(Span)
     ),
     wDate: Now()
     },
     ForAll(
     DataCardValue65.SelectedItems As i,
     ForAll(
     DataCardValue63.SelectedItems As j,
     ForAll(
     wDays,
     Patch(
     'Products List',
     Defaults('Products List'),
     {
     'Product Code': Value(DataCardValue66.Text),
     'Package type': Table({Value: i.Value}),
     Title: DataCardValue54.Text,
     'Batch No.': DataCardValue55.Text,
     'Samples Description': DataCardValue35.Text,
     'Stability Conditions': Table({Value: j.Value}),
     'No. of samples': DataCardValue60,
     Location: DataCardValue67.Text,
     'Incubation Date': wDate,
     'Stability Interval': Period,
     'Expected Withdrawal date': DateAdd(
     wDate,
     AddDays,
     TimeUnit.Days
     ),
     'Stability Period': DateAdd(
     wDate,
     AddDays,
     TimeUnit.Days
     )
     }
     )
     )
     )
     )
    );

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard