web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to create an Edit ...
Power Apps
Answered

How to create an Edit Form for a gallery that is based on a SQL View

(0) ShareShare
ReportReport
Posted on by 227

How do I create an edit form, and new form

from a gallery based on a SQL view

I understand I can use patch to submit the data to multiple tables once the edit/new form is configured

please and thank you

Jese

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @jesenavaranjan,

    Could you please share a bit more about your scenario?

    Do you want to patch form data into your SQL View or these base tables your SQL View based on?

    If you want to patch form data into your SQL View directly, I afraid that there is no way to achieve your needs in PowerApps currently.

    The SQL View data sources are read-only in PowerApps currently, we could not patch any data into the SQL View from an app. But as an alternative solution, you could patch form data into the base tables (which your SQL View relies on) based on the primary key columns in your SQL View.

    Please check the following blog for more details:

    https://powerapps.microsoft.com/en-us/blog/using-sql-server-views-in-powerapps/

     

    If you want to patch form data into your base tables your SQL View relies on, I think the Patch function could achieve your needs.

    Firstly, you need to add your base SQL tables as data source into your app. Then add a Edit form control within your app, set the DataSource property of the Edit form to one SQL Table. Set the Item property of the Edit form to following:

     

    LookUp('[dbo].[Employees]', Id = BrowseGallery1.Selected.Id)

    On your side, you should type:

     

    LookUp('[dbo].[BaseTable]', PrimaryColumn = BrowseGallery1.Selected.PrimaryColumn)

    Note: The PrimaryColumn represents the Primary Key column in your base table, the PrimaryColumn represents the Primary Key column in your SQL View, which also referenced from the PrimaryColunn in your base table.1.JPG

    If you want to edit an existing record in your base tables based on the selected SQL View record in the Gallery, please take a try with the following formula:

    Patch(
     '[dbo].[BaseTable]',
     LookUp('[dbo].[BaseTable]', PrimaryColumn = BrowseGallery1.Selected.PrimaryColumn),
     EditForm1.Updates /* <-- EditForm1 represents the Edit form control */
    )

    Or

    Patch(
     '[dbo].[BaseTable]',
     LookUp('[dbo].[BaseTable]', PrimaryColumn = BrowseGallery1.Selected.PrimaryColumn),
     {
    Column1: DataCardValue1.Text,
    Column2: DataCardValue2.Text,
    ...
    }
    )

     

    If you want to add a new record into your base tables, please take a try with the following formula:

    Patch(
     '[dbo].[BaseTable]',
     Defaults('[dbo].[BaseTable]'),
     EditForm1.Updates /* <-- EditForm1 represents the Edit form control */
    )

     

    Best regards,

    Kris

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard