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

Help with Patch formula on form with 3 data sources

Hello PowerApps power users...

I've been working on a PowerApps form SharePoint integration for awhile but can't seem to find the correct formula so that the SharePoint form fields submit back to the form as well as fields pulling data from other sources: the SharePoint form data, a second SharePoint list and a SQL database.

 

My formula looks like this: (with the specific fields within the patch referring to the second/third data sources)

 

Patch(

    NEWEscalationRequest, Defaults(NewEscalationRequest),

    {E365Account:E365Account_DataCard2,Product:Product_DataCard2, E365UltimateID:E365UltimateID_DataCard2.DataField,EnterpriseSuccessManager:EnterpriseSuccessManager_DataCard2.DataField,SupportAccountManager:SupportAccountManager_DataCard2.DataField,ProductID:ProductID_DataCard2,ProductManager:ProductManager_DataCard2.DataField,ProductBrand:ProductBrand_DataCard2.DataField

    })

;Navigate(Complete, None)

 

I was surprised that the Product data card would not accept anything after the dot(.) and did not throw an error when left without a control name.

Here is an example of two fields pulling from a separate data source

  • Products field: Sort(Distinct('[PROD].[Products]',Name),Result)
  • Product ID field: Filter('[PROD].[Products]', Name = DataCardValue12.Selected.Result)

Currently, the form submits to list with only the SharePoint list fields populating.

Any guidance very much appreciated!

10 REPLIES 10
RandyHayes
Super User
Super User

@acoliva 

Yes, because we need to have your form actually get those values from the place you want.
Each DataCard in your Form will have a DataCardValue control.  It is that control that we are concerned with setting the Default values.

So, in the case of your Product...you say that is based on a SQL Database.  I assume that it is that input that then determines the values for ProductID, ProductManager, and ProductBrand.  So, assuming that is a Text column and you have a Textinput control for the DataCardValuexxx  in that datacard, its Default Should be set to Parent.Default.  

 

For your ProductID, the Default on that DataCardValue control would be:

   Coalesce(Parent.Default, LookUp(yourSQLList, Product=DataCardValuexxx , ProductID))

 

This will display the stored ProductID from the SharePoint list when you are editing a record, otherwise it will show the ProductID from the SQL database when you are creating a new record.  

 

Replace the names above with names of actual controls and fields in your app.

 

Your original Patch was not pushing values to your list, most all of your columns were using the DataField property, which is just the name of the field for the datacard...not a value.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,811)