cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gazzo1967
Level 8

Help Needed with Patch function

Hi all

I need some help from one of you super guru's here Smiley Happy

Scenario

I have a power app that populates part one of the sharepoint list

This populates the Title and the other fields except 3.

Then i am using a second powerapp to populate the other 3 fields.

to do this i am using a gallery with patch function.

The Title field is a unique number which is used in the second app as the filter using a textinput to return the already populated fields with the other three fields as a combobox, a list and multiline textbox.

 

i know that i have to use the Title field so i am trying to use the filter input text box to Patch the Title and the other 3 fields but i just can't get it to work. If i write the formula it doesn't show any errors but as soon as i test it doesn't work and i can't figure it out!

 

Patch(TFF_PDP_Sign_Off,
Defaults(TFF_PDP_Sign_Off),
{
Title:tffsearch.Text,
QA_criteria:ListBox1.Selected,   (this is multi select should this be selecteditems?)
Approval_status:ComboBox5.Selected,
Approval_Rejection_Rationale:TextInput2
})

 

So what i am doing is using 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Help Needed with Patch function

Hi @gazzo1967 ,

Do you want to modify data, not create new data?

Firstly, since the data of Title field have been submitted, you need to use the formula about modifying, not creating.

Secondly, could you tell me the data type of  QA_criteria,Approval_status,Approval_Rejection_Rationale field?

                                             the items of ListBox1 and ComboBox5?

Since you use listbox and combo box, you also need to tell me whether QA_criteria,Approval_status is multiple selection.

I assume that:

QA_criteria and Approval_status is multiple choice, Approval_Rejection_Rationale is text.

Set ListBox1's Items: Choices(TFF_PDP_Sign_Off.QA_criteria)

Set the ComboBox5's Items: Choices(TFF_PDP_Sign_Off.Approval_status)

Set the submit button's OnSelect: 

Patch(TFF_PDP_Sign_Off,
LookUp(TFF_PDP_Sign_Off,Title=tffsearch.Text),
{
QA_criteria:ListBox1.SelectedItems,   
Approval_status:ComboBox5.SelectedItems,
Approval_Rejection_Rationale:TextInput2.Text
})

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 REPLIES 8
RezaDorrani
Level 10

Re: Help Needed with Patch function

Hi @gazzo1967 

 

You trying to add new item I assume and not update an existing item?

RezaDorrani
Level 10

Re: Help Needed with Patch function

Hi @gazzo1967 

 

combobox patch example

https://powerusers.microsoft.com/t5/General-Discussion/Patch-issues-combobox/td-p/137617

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Super User
Super User

Re: Help Needed with Patch function

The "Defaults(TFF_PDP_Sign_Off)" in the second parameter means you want to create a new item with Patc and not update an existing item. To update an existing item the second parameter needs to be the record that is being updated. If the item is in the gallery and selected then you just need to use GalleryName.Selected as second parameter. 

 

I think yo uwill also need to change "QA_criteria:ListBox1.Selected" to "QA_criteria:ListBox1.SelectedItems"



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
gazzo1967
Level 8

Re: Help Needed with Patch function

@Jeff_Thorpe 

That makes sense I Think

Title is populated but the other 3 fields are blank

How would i get ariund this?

You can put a form inside a gallery or can you lol

Regards Gary

gazzo1967
Level 8

Re: Help Needed with Patch function

@RezaDorrani 

As i have rsponded to @Jeff_Thorpe 

The Title field is being amended but the other fields are blank with now data as its being entered on the 2nd form

Regards Gary

Community Support Team
Community Support Team

Re: Help Needed with Patch function

Hi @gazzo1967 ,

Do you want to modify data, not create new data?

Firstly, since the data of Title field have been submitted, you need to use the formula about modifying, not creating.

Secondly, could you tell me the data type of  QA_criteria,Approval_status,Approval_Rejection_Rationale field?

                                             the items of ListBox1 and ComboBox5?

Since you use listbox and combo box, you also need to tell me whether QA_criteria,Approval_status is multiple selection.

I assume that:

QA_criteria and Approval_status is multiple choice, Approval_Rejection_Rationale is text.

Set ListBox1's Items: Choices(TFF_PDP_Sign_Off.QA_criteria)

Set the ComboBox5's Items: Choices(TFF_PDP_Sign_Off.Approval_status)

Set the submit button's OnSelect: 

Patch(TFF_PDP_Sign_Off,
LookUp(TFF_PDP_Sign_Off,Title=tffsearch.Text),
{
QA_criteria:ListBox1.SelectedItems,   
Approval_status:ComboBox5.SelectedItems,
Approval_Rejection_Rationale:TextInput2.Text
})

Best regards,

Community Support Team _ Phoebe Liu

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gazzo1967
Level 8

Re: Help Needed with Patch function

@v-yutliu-msft 

Thanks for the response

 

You were correct other than i had to change

ComboBox5 is a single selection

I changed the formula to reflect this and it work perfect Smiley Very Happy

 

Never thought to use LookUp as i was trying to modify an existing entry and populate others that are blanl.

Im loving this!

Learn so much very quickly

Thank you

gazzo1967
Level 8

Re: Help Needed with Patch function

Thanks again Smiley Happy

Works perfect

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 45 members 4,994 guests
Please welcome our newest community members: