cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Use combobox to patch text values to Sharepoint List

Please see the attached image as it outlines the issue in greater detail.  

 

I am working with two Sharepoint Lists as datasources: 

List 1:  TrainingPlan

List 2: Trainings

Both have a text field called “Training_Name”

 

I have an grid-like gallery (CurrentTrainingPlan, attached) based on the TrainingPlan list. When in Edit mode, as below, I want to be able to select “Training_Name” values from the Trainings list in the CourseCombo combobox and patch the value to the TrainingPlan SP list.  I receive the error outlined in GREEN in attached image.

 

I also receive an error related to the the SaveIcon, OnSelect property outlined in RED in attached image.  The OnSelect property is Patch(TrainingPlan, ThisItem, {Training_Name: CourseCombo.Selected.Value})

 

Based on the error messages, it seems apparent that the text data type is part of the problem.  But I’m stumped because I feel I have seen others very similar solutions. 

 

Help much appreciated! 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Use combobox to patch text values to Sharepoint List

Hi@mrlang02,

Based on the issue that you mentioned, do you want to display the currently selected item within the ComboBox?

Since the 'Training_Name' column is a Text type, you should not directly set the DefaultSelectedItems as ThisItem.Training_Name which is a Text value rather than a Table.

I have a test on my side, please take a try as below.

Set the DefaultSelectedItems property of the ComboBox as below:

 

ThisItem

 

 

Best Regards,

Qi

View solution in original post

7 REPLIES 7
Highlighted

Re: Use combobox to patch text values to Sharepoint List

@mrlang02  Can you try combobox.selected.text?

 

 

Highlighted
Frequent Visitor

Re: Use combobox to patch text values to Sharepoint List

I assume you mean to change that in the Patch function?  I changed the SaveIcon OnSelect prop to Patch(TrainingPlan, ThisItem, {Training_Name: CourseCombo.Selected.Text}) but it does not work.  I get the message "The Type of argument 'Training_Name' does not match the expected type 'Text'.  Found type 'Error'."

 

I found I CAN update the table by using Patch(TrainingPlan, ThisItem, {Training_Name: CourseCombo.Selected.'Training Name'}).

 

However, I can't get the default value of the CourseCombo to reflect back the existing/updated value.  I have tried setting the Default and DefaultSelectedItems props of the CourseCombo box to ThisItem.Training_Name with no success.  See attached.  I know the selection data gets patched, however, because I added TextInputBox to view the results (Default=ThisItem.Training_Name) and can see the values change when I make a selection in the combobox and hit the save icon.  

 

So how do I get the combobox to show the default, current value?

 

 

 

 

Highlighted

Re: Use combobox to patch text values to Sharepoint List

@mrlang02  I have seen power app throwing that kind of error and i used text function to make sure that dropdown value is type casted to text.

Highlighted
Frequent Visitor

Re: Use combobox to patch text values to Sharepoint List

Thanks.  I don't know if you saw my last reply but I think I have resolved the patch issue.  But now I am struggling to get the combobox to reflect the updated values after the patch.  If it is important, to clarify, the source of the combobox is in a different table than the rest of the gallery data.  

Highlighted
Frequent Visitor

Re: Use combobox to patch text values to Sharepoint List

 

This shows the error I'm receiving on the combobox.  The current value of Training_Name will not show up there.  The TextInputBox under "Course" shows the value that is patched when the combobox selection is patched.  However, I would like for this to show up in the combobox, not a separate text box. 

 

Capture3.PNG

Highlighted
Frequent Visitor

Re: Use combobox to patch text values to Sharepoint List

Since the direction of my questions has changed somewhat, I am reposting under new thread here:

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Unable-to-view-current-value-in-gallery-The-...

Highlighted
Microsoft
Microsoft

Re: Use combobox to patch text values to Sharepoint List

Hi@mrlang02,

Based on the issue that you mentioned, do you want to display the currently selected item within the ComboBox?

Since the 'Training_Name' column is a Text type, you should not directly set the DefaultSelectedItems as ThisItem.Training_Name which is a Text value rather than a Table.

I have a test on my side, please take a try as below.

Set the DefaultSelectedItems property of the ComboBox as below:

 

ThisItem

 

 

Best Regards,

Qi

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,481)