cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
s1hl3_ukuvuma
Level: Powered On

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
Super User

Re: Patch to SQL database using a collection from SharePoint

@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.

View solution in original post

Super User
Super User

Re: Patch to SQL database using a collection from SharePoint

@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.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Patch to SQL database using a collection from SharePoint

@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.

View solution in original post

s1hl3_ukuvuma
Level: Powered On

Re: Patch to SQL database using a collection from SharePoint

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

s1hl3_ukuvuma
Level: Powered On

Re: Patch to SQL database using a collection from SharePoint

@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.

Super User
Super User

Re: Patch to SQL database using a collection from SharePoint

@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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,865)