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

How to update multiple controls in single datacard?

Due to the design I have placed multiple controls in single datacard. But I don't know how to update data back to sharepoint for those controls. I tried `Update` with Patch with those fields but I showing error not use Patch in `Update`.

 

Now, I tried same Patch in Save button `OnSelect` still now working. Can someone give steps how update those fields back to sharepoint on Save.

 

In the below Image I have added 'ADP` and `Requester` two fields to Title_DataCard1. 

 

Save button OnSelect and wrote Patch update only Title and ADP (for testing purpose) . Not working...

 

Patch('Projects And Tasks POC',Defaults('Projects And Tasks POC'),{Title: DataCardValue4.Text,ADP:ADP_Text.Text})

 

2018-10-16_14-51-22.png

 

Please tell where to update these?

6 REPLIES 6
Super User
Super User

Re: How to update multiple controls in single datacard?

Hi @Itsmesri,

It seems that you are trying to make the form do more than it was designed to do.  To quote @Meneghino 

"Quite often you want to customise the out-of-the-box forms that PowerApps provides, for example to:

  • Collect user input over more than one screen
  • Implement cascading dropdowns or combo boxes
  • Include business logic in the forms
  • Combine user input with other data 

In my experience it is often easier to create your own form(s) from scratch and then adding the bells and whistles, rather than customising the out-of-the-box forms."  I wholeheartedly agree with him and would refer you to his blog post https://baizini-it.com/blog/index.php/2017/09/28/powerapps-101-create-your-own-forms/ for a most excellent step by step solution.  

Community Support Team
Community Support Team

Re: How to update multiple controls in single datacard?

Hi @Itsmesri,

Is there something error with the Patch function within your app?

Do you want to create a new record into your SP list ot update an existing record in your SP list using Patch function?

If you want to create a new record into your SP list using Patch function, I have made a test on my side, the Patch function works well. The screenshot as below:8.JPG

 

9.JPG

Set the OnSelect proeprty of the "Save" button to following:

Patch(
    '20181019_case9_Courses',
     Defaults('20181019_case9_Courses'),
     {
         Title: DataCardValue4.Text,
         TagNumber: Value(TextInput1.Text),
         Outcome: {
                  '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                   Id: Dropdown1.Selected.Id,
                   Value: Dropdown1.Selected.Value
                 }
    }
)

Note: The '20181019_case9_Courses' represents the SP list data source within my app. The Outcome column is a LookUp type column within my SP list. In addition, the "Save" button is outside the Edit form.

 

If you want to update an existing record in your SP list using Patch function, I think there is something wrong with the formua that you provided. Please modify your formula as below:

Patch(
    'Projects And Tasks POC',
     BrowseGallery1.Selected,   /* <-- Modify here */
     {
         Title: DataCardValue4.Text,
         ADP: ADP_Text.Text
    }
)

Note: I assume that you use a Gallery control (BrowseGallery1) to list all records of your SP list within your app.

On your side, please set the OnSelect proeprty of the "Save" button to following formula:

If(
    EditForm1.Mode=FormMode.New,               /* <-- The EditForm1 represent the Edit form control within your app */
    Patch(
          'Projects And Tasks POC',
           Defaults('Projects And Tasks POC'),
           {
            Title: DataCardValue4.Text,
            ADP: ADP_Text.Text
           }
    ),
    Patch(
          'Projects And Tasks POC',
           BrowseGallery1.Selected,   /* <-- Modify here */
           {
            Title: DataCardValue4.Text,
            ADP: ADP_Text.Text
           }
    )
)

You could also consider take a try to update the existing record within your SP list using UpdateIf function as below:

UpdateIf(
    'Projects And Tasks POC',
    ID= BrowseGallery1.Selected.ID,
    {
     Title: DataCardValue4.Text,
     ADP: ADP_Text.Text
    }
)

If the issue still exists, please take a try to re-create your app, then check if the issue is solved.

 

More details about the Patch function and UpdateIf function, please check the following article:

Patch function

UpdateIf function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Itsmesri
Level: Powered On

Re: How to update multiple controls in single datacard?

@

 

 

Community Support Team
Community Support Team

Re: How to update multiple controls in single datacard?

Hi @Itsmesri,

Could you please share a bit more about the Item property of the Edit form within your app?

If you don't use a Gallery within your app to list all records of your SP list, and you want to update an existing record within your SP list, you must firstly find the record you want to update within your SP list.

Please modify your Patch formula for updating an existing record within your SP list as below:

Patch(
  'YourSPList',
   LookUp('YourSPList', Column1= DataCardValue1.Text),   /* find the record you want to update */
   {
    Title: DataCardValue4.Text,
    ADP: ADP_Text.Text
   }
)

Or

Patch(
  'YourSPList',
   The formula within the Item property of your Edit form,   /* Type same formula as that within the Item property of your Edit form */
   {
    Title: DataCardValue4.Text,
    ADP: ADP_Text.Text
   }
)

Note: Above formula only works when you want to update an existing record within your SP list.

 

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Itsmesri
Level: Powered On

Re: How to update multiple controls in single datacard?

@v-xida-msft

 

Thank you update and new working at same time. It is good now. But now I stuck at multiple peopel update in patch.

 

If(!IsBlank(CurrentItem),Patch('Projects And Tasks POC',LookUp('Projects And Tasks POC',ID = CurrentItem.ID),
{Title: DataCardValue4.Text, 
  ADP:ADP_Text.Text,
  Requester:{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
  Claims:"i:0#.f|membership|" & Lower(requesterCmb.Selected.Email),
  Department:"",
  DisplayName:requesterCmb.Selected.DisplayName,
  Email:requesterCmb.Selected.Email,
  JobTitle:".",
  Picture:"."}}))

If I have multiple people in the combobox how to update them in the patch?

 

 

2018-10-25_10-27-38.png

 

Where I am doing mistake?

 

SteveJ600
Level: Powered On

Re: How to update multiple controls in single datacard?

I was able to do this by adding the data card associated to the SharePoint column you are trying to update and then adding the radio button in the a different datacard.  The first data card has no controls and is set to hidden, but has the update field is set to the name of the radio.selected.  See attached screenshot.

Helpful resources

Announcements
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 (5,397)