cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Patching all contents of a combo box that have been selected

Hello All,

 

I have a request form and one of the required fields is a "Region" Combo box in which they can select more than 1 option. I am trying to Patch all the items selected.

 

I am currently using the code to Patch all the required fields. I understand that I am only putting "Region: RegionInput.Selected" as the code, but "SelectedItems" comes up as an error.

 

CURRENT CODE FOR WHOLE PATCHING (This one only shows the first item selected and not all items selected fro "Region"):

 

Patch('Training Requests',Defaults('Training Requests'),
{Title: "Training Requests",
TrainingPOC: User().FullName,
MicrosoftEmail: EIDText_Input.Text,
DateRequested: Text(Today(), "[$-en-US] mmmm dd, yyyy"),
TrainingDeploymentDate: DatePicker1.SelectedDate,
TrainingMaterial: TrainingMText_Input.Text,
MaterialLink: MaterialLText_Input.Text,
Process: Dropdown1.Selected,
LOB: LOBText_Input.Text,
Region: RegionInput.Selected,
ShiftSchedule: ShiftSText_Input.Text,
Comments: 'CommentBox_Confi.'.Text,
NumberOfTrainees: Value(NumbOfTrain_Input.Text)});

 

Anyway I can patch all the items selected in the combo box?? including a comma if that is possible.

 

Any help is appreciated,

Mono

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Have you enabled "Allow multiple options" option for the "Region" field in your SP List?
Could you please share more details about the formula you typed within the Items property of the RegionInput ComboBox?

 

Based on the issue that you mentioned, I think there is something wrong with your formula. Please consider modify your formula as below:

Patch(
      'Training Requests',
       Defaults('Training Requests'),
       {
        Title: "Training Requests",
        TrainingPOC: User().FullName,
        MicrosoftEmail: EIDText_Input.Text,
        DateRequested: Text(Today(), "[$-en-US] mmmm dd, yyyy"),
        TrainingDeploymentDate: DatePicker1.SelectedDate,
        TrainingMaterial: TrainingMText_Input.Text,
        MaterialLink: MaterialLText_Input.Text,
        Process: Dropdown1.Selected,
        LOB: LOBText_Input.Text,
        Region: ForAll(                 // Modify formula here
                        RegionInput.SelectedItems,
                        {
                          Value: DisplayColumn   // Displaycolumn represents the column you used as display value within the RegionInput
                        }
                ),
        ShiftSchedule: ShiftSText_Input.Text,
        Comments: 'CommentBox_Confi.'.Text,
        NumberOfTrainees: Value(NumbOfTrain_Input.Text)
       }
);

Note: Please make sure you have enabled "Allow multiple selections" option for the Region Choice column in your SP List already. If not, please enable the "Allow multiple selections" option for the Region Choice column in your SP List, then refresh the SP list connection in your app manually to apply changes.

 

If you do not enable "Allow multiple selections" option for the Region Choice column in your SP List, you could not patch multiple options back to the Region field from your app.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

In the field's, in OnChange property, start a collection.

Collect(arrRegion,
ForAll(
Filter(
[List Name that contains Region],
[Region Field of The List] = [DataCard that user select Region].SelectedText.Value
),
[property you want to display]
)
)

After, you will need to use the concat function in your patch. 

Concat(Distinct(arrRegion, [Field]); Result & "; ")

The ";" is the delimiter.

 

I did this with submitform, try with patch and tell me! (:

Anonymous
Not applicable

@Anonymous  Thanks for the advice! Going to try it ASAP. Quick question, in which "OnChange" will I be putting the Collect? On the "Next" button of my Request Form?

 

Region Collect_LI.jpg

 

Thank You!

Anonymous
Not applicable

From the field the user selects the region.
I have to change my field to combobox, dropdown doesn't work!
Anonymous
Not applicable

Okay, I am trying to Collect the items...... only one problem that I am trying to solve:

 

 

Region Collect Code.PNG

 

All works... except for the equal sign? I've tried a few different things so far and it's not working.

Anonymous
Not applicable

RegionInput is a dropdown?
RegionInput.SelectedText.Value

The field Region in your database is what kind?
Anonymous
Not applicable

Region field is a combo box so that the User can select more than one option. I want to Patch all the options selected into my SharePoint List.

Anonymous
Not applicable

The "Region" field in my SharePoint List is a Choice column.

v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Have you enabled "Allow multiple options" option for the "Region" field in your SP List?
Could you please share more details about the formula you typed within the Items property of the RegionInput ComboBox?

 

Based on the issue that you mentioned, I think there is something wrong with your formula. Please consider modify your formula as below:

Patch(
      'Training Requests',
       Defaults('Training Requests'),
       {
        Title: "Training Requests",
        TrainingPOC: User().FullName,
        MicrosoftEmail: EIDText_Input.Text,
        DateRequested: Text(Today(), "[$-en-US] mmmm dd, yyyy"),
        TrainingDeploymentDate: DatePicker1.SelectedDate,
        TrainingMaterial: TrainingMText_Input.Text,
        MaterialLink: MaterialLText_Input.Text,
        Process: Dropdown1.Selected,
        LOB: LOBText_Input.Text,
        Region: ForAll(                 // Modify formula here
                        RegionInput.SelectedItems,
                        {
                          Value: DisplayColumn   // Displaycolumn represents the column you used as display value within the RegionInput
                        }
                ),
        ShiftSchedule: ShiftSText_Input.Text,
        Comments: 'CommentBox_Confi.'.Text,
        NumberOfTrainees: Value(NumbOfTrain_Input.Text)
       }
);

Note: Please make sure you have enabled "Allow multiple selections" option for the Region Choice column in your SP List already. If not, please enable the "Allow multiple selections" option for the Region Choice column in your SP List, then refresh the SP list connection in your app manually to apply changes.

 

If you do not enable "Allow multiple selections" option for the Region Choice column in your SP List, you could not patch multiple options back to the Region field from your app.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-xida-msft  That was my problem. I did not change it to allow multiple choices. Thanks for the help!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,135)