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

Sending inputs to SharePoint List - Patch function

I am trying to send the input from the PowerApp to a SharePoint List, but keep getting errors in my formula.

 

Navigate(Screen2,Cover) And Patch('KloudGin New Users', Defaults('KloudGin New Users'), {First_Name: TextInput1.Text}, {Last_Name: TextInput1_1.Text}, {Region: ddRegion.Selected.Result}, {Cost_Center: ddRegion_1.Selected.Value})

 

Error: The type of this argument 'CostCenter' does not match the expected type 'Text'.  Found type 'Error'.

 

What part am I missing?

1 ACCEPTED SOLUTION

Accepted Solutions
marypolitan
Level: Powered On

Re: Sending inputs to SharePoint List - Patch function

@v-yutliu-msft  I finally got it to work! I had to take the underscores and spaces out between the column label names.  I also had an issue with trying to also use the Navigate function but I was using it incorrectly.  Here is final working formula:

 

Patch('KloudGin New Users',Defaults('KloudGin New Users'),{Region:ddRegion.Selected.Result,BranchPlant:ddRegion_1.Selected.'Branch Plant',FirstName:TextInput1.Text,LastName:TextInput1_1.Text}); Navigate(Screen2,ScreenTransition.Cover)

 

Thank you so much for all your help!

12 REPLIES 12
Super User
Super User

Re: Sending inputs to SharePoint List - Patch function

Try changing your code to:

Patch('KloudGin New Users', Defaults('KloudGin New Users'),
{First_Name: TextInput1.Text},
{Last_Name: TextInput1_1.Text},
{Region: ddRegion.Selected.Result},
{Cost_Center: ddRegion_1.SelectedText.Value})

marypolitan
Level: Powered On

Re: Sending inputs to SharePoint List - Patch function

Thank you for your reply. I tried that and now I have the following error:

 

Invalid argument type.  Expecting one of the following: Boolean, Number, Text.

v-yutliu-msft
Level 10

Re: Sending inputs to SharePoint List - Patch function

Hi @marypolitan ,

Could you tell me how do you set the drop down named ddRegion_1?

I've made a similar test for your reference:

Set the ddRegion_1 drop down's Items: 'KloudGin New Users'

                                                     Value:Cost_Center

Set the submit button's OnSelect:

Patch('KloudGin New Users', Defaults('KloudGin New Users'),
{First_Name: TextInput1.Text,Last_Name: TextInput1_1.Text,
Region: ddRegion.Selected.Result,Cost_Center: ddRegion_1.Selected.Cost_Center}
)

The operator of "{}" represents record.

The right format is : {field1:...,field2:...},{field1...,field2:...}

 

Best regards,

Community Support Team _ Phoebe Liu

marypolitan
Level: Powered On

Re: Sending inputs to SharePoint List - Patch function

Hi @v-yutliu-msft  - thanks for explaining about the {} being a record instead of a field of a record. That helped.  I think the other part is not working because ddRegion_1 drop down is dependent on value chose in ddRegion.  How would I enter that?

v-yutliu-msft
Level 10

Re: Sending inputs to SharePoint List - Patch function

Hi @marypolitan ,

Could you tell me

1)Region's data type and Cost_Center's data type?

2) how ddRegion_1 dependent on value chose in ddRegion?

 

Best regards,

Community Support Team _ Phoebe Liu

 

marypolitan
Level: Powered On

Re: Sending inputs to SharePoint List - Patch function

@v-yutliu-msft I'm sorry for the slow reply. I went on vacation and did not have access to respond.  

 

1. the data is pulling from a SharePoint list.  I'm not sure what you mean by data type.  I've attached some screenshots if that helps.

2. What ever is selected as Region, gives column 2 of SharePoint list as an option.  Screenshot attached.

 

cost center formula.jpgregion data.jpgcost center.jpg

v-yutliu-msft
Level 10

Re: Sending inputs to SharePoint List - Patch function

Hi @marypolitan ,

Could you tell me

1)where do you use the formula "Filter(Region.....)"? (picture1)

2)the ddRegion's Items and ddRegion1's Items?

3)is Branch Plant a fieldname?

What's more, you could check the field's data type here:

In sharepoint list, choose the fieldname, choose column settings, edit.6122_LI.jpg

 

6123_LI.jpg

It's very important to know the field's data type when updating data. Different data type need different formula to update.

 

Best regards,

Community Support Team _ Phoebe Liu

marypolitan
Level: Powered On

Re: Sending inputs to SharePoint List - Patch function

Hi @v-yutliu-msft 

1. That formula shows when I click on the drop down for Cost Center.

2. Screenshot of the items in list below.

3. Yes Branch Plant is a field name.

4. Data type for both fields are showing 'single line of text'

 

Thanks!!

screenshot sharepoint list.jpg

v-yutliu-msft
Level 10

Re: Sending inputs to SharePoint List - Patch function

Hi @marypolitan ,

I've set ddRegion_1 dependent on ddRegion but not met the problem like your description.

According to your screenshoot, ddRegion_1 display Branch Plant field and its default is set to Cost_Center.

So I assume that Cost_Center is a value and Branch Plant is the field that need to update.

Try this formula:

Patch('KloudGin New Users', Defaults('KloudGin New Users'),
{First_Name: TextInput1.Text,Last_Name: TextInput1_1.Text,
Region: ddRegion.Selected.Result,Branch Plant: ddRegion_1.Selected.Branch Plant}
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu