Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Save Data From PCF component into Sql Server.

(0) ShareShare
ReportReport
Posted on by

Hi,

I'm using PCF component code in my PowerApps to display the reports. 

So, there is one save button and by clicking on that, the reports data have to be save in SQL Server DB table.

I'm trying to connect my PCF component code from SQL Server DB but I'm unable to connect it. And i'm not finding anywhere like how to connect PCF  with DB.

If anyone know about how to save Data from PCF code in powerapps please let me know.

 

Thanks

Categories:
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: Save Data From PCF component into Sql Server.

    Hi @DBTS7 , 

     

    Hier are the docs about using the SQL connector inside Canvas Apps: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/connections/connection-azure-sqldatabase?WT.mc_id=BA-MVP-5004107 (works similar in Custom Pages).

    Here is the turorial about creating a dataset PCF for model-driven apps: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/tutorial-create-model-driven-app-dataset-component?WT.mc_id=BA-MVP-5004107

    And I have a blog here about saving using the dataset PCF: Editable Dataset PCF: New SDK Methods – Dianamics PCF Lady (wordpress.com)

     

    Hope this helps!

  • DBTS7 Profile Picture
    on at
    Re: Save Data From PCF component into Sql Server.

    Hi @a33ik ,

    could you please elaborate like how I can use plugins?

    Is there any docs or any link by which i may take help?

     

    Thanks

  • DBTS7 Profile Picture
    on at
    Re: Save Data From PCF component into Sql Server.

    Hi @DianaBirkelbach ,

    I'm new to PowerApps so I exactly don't know how we can connect.

    I tried to understand your logic and I guess we're not using PCF of type Dataset in out PCF code.

    DBTS7_0-1664291491761.png

    Is there any other way by which I can save PCF data(from Canvas apps) to SQL server?

     

    Thanks.

     

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: Save Data From PCF component into Sql Server.

    Hi @DBTS7 , 

    PCF works best, if you let the platform provide the data for you.

    I have a wild idea about how I would approach this:

     

    If you have a PCF of type dataset, it will provide the data for you (Dataverse data you need for the "report").

    You can also have a second dataset inside the same PCF, and using a SQL connector you could provide the data to your PCF using PowerFx (a collection containng SQL data).
    The dataset has on Canvas Apps also a method which allows to add records to the dataset : https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/dataset/newrecord?WT.mc_id=BA-MVP-5004107. You have there also methods to save the data. So you could save the data to SQL that way.

     

    I must say that I've never tested this kind of approach. All I did was connect a PCF to Excel (inside a Custom Page using the Excel connector), and used the PCF dataset save methods to save the changes to my excel file.

    But I don't know if it works with SQL Connector and not so sure if this PCF edit methods are supported for now.

    In the SDK I understand that save methods are GA for model-driven apps, but experimental for Canvas Apps: https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/entityrecord?WT.mc_id=BA-MVP-5004107#methods

     

     

  • a33ik Profile Picture
    3,304 Most Valuable Professional on at
    Re: Save Data From PCF component into Sql Server.
    I don't think you will be able to communicate to SQL DB directly from your PCF control so my recommendation is to create an action, add a plugin that will handle that action's message and do whatever operations you need with the SQL and call that action from your PCF's code in order to send the data to action.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard