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

Patch to SQL database using a collection from SharePoint

I am getting an error on my patch function:

 

The Type of this argument 'Category does not match the expected type 'Text'. Found Type 'Error.

 

Formula:

 

Patch(
'[dbo].[Test]',
Form_Record,
{
Title: Title_value.Text,
Category: First(Category_value.SelectedItems).Value
}

)

 

When I use:

Category: First(Category_value.SelectedItems).Title 

 

It does not complain, but it does not save the data.

 

The Category is from a Sharepoint List.

 

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User III
Super User III

@s1hl3_ukuvuma 

Getting a type of error is not a good thing.  

I'd first start with putting a label on your screen to test with the Texdt property of Category_value.Selected.Title and verify that you are getting an actual value in that.

Then, I'd check over the Items property for the ComboBox to make sure there are no issues with the items or the datasource.

 

See if any of those help you get to the next clue.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

@s1hl3_ukuvuma 

So, first, can you verify in your SQL table if the value is getting populated or not?  Rather than deduce that it is not there based on what you see in PowerApps, it would be best to look directly at the data to see what is there.  Perhaps you have, but I wanted to state that point.

 

Next, let's alter the fomula just a bit to be a little more accurate:

Patch('[dbo].[Test]',
      Defaults('[dbo].[Test]'),
      {
         AbpmWFRecordID: Form_RecordWFID,  // I assume this is a variable and this is not your primary key
         Title: Title_value.Text,
         Category: Category_value.Selected.Title  // Assume you have no reason for the combobox to be multi-select
      }
)

Let's run the above.  Then look directly at the table in SQL and see what you are getting there.

 

EDIT: fixed typo in formula.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

4 REPLIES 4
Super User III
Super User III

@s1hl3_ukuvuma 

Getting a type of error is not a good thing.  

I'd first start with putting a label on your screen to test with the Texdt property of Category_value.Selected.Title and verify that you are getting an actual value in that.

Then, I'd check over the Items property for the ComboBox to make sure there are no issues with the items or the datasource.

 

See if any of those help you get to the next clue.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Hi Randy.

 

Category_value.selected.Title does give me a value.

 

It just didn't look right to me but it works fine.

 

Thanks man

@RandyHayes 

 

When I log out of the app and log in again, the Text inputboxes patched with First(Category_value.SelectedItems).Title appear to be blank. Which means SQL is not accepting this as a value

 

I have added attachements to give you an indication of what I am trying to achieve

Patch formula:

Patch(
'[dbo].[Test]',
{ID: Blank()},
{
AbpmWFRecordID: Form_RecordWFID,
Title: Title_value.Text,
Category: First(Category_value.SelectedItems).Title

}

Category: First(Category_value.SelectedItems).Value is not working as previously explained.

@s1hl3_ukuvuma 

So, first, can you verify in your SQL table if the value is getting populated or not?  Rather than deduce that it is not there based on what you see in PowerApps, it would be best to look directly at the data to see what is there.  Perhaps you have, but I wanted to state that point.

 

Next, let's alter the fomula just a bit to be a little more accurate:

Patch('[dbo].[Test]',
      Defaults('[dbo].[Test]'),
      {
         AbpmWFRecordID: Form_RecordWFID,  // I assume this is a variable and this is not your primary key
         Title: Title_value.Text,
         Category: Category_value.Selected.Title  // Assume you have no reason for the combobox to be multi-select
      }
)

Let's run the above.  Then look directly at the table in SQL and see what you are getting there.

 

EDIT: fixed typo in formula.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Users online (7,206)