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 update sql tabl...
Power Apps
Answered

how to update sql table by submit button

(0) ShareShare
ReportReport
Posted on by 70

Hi,

 

I want to click submit button , then the SQL DB table will be updated by studentID.TEXT and EventID from Event fropdown.

the below datatable could be refreshed aftyer submit button clicked. And the confirmed student's row will have the confirmed checkedbox to be checked. 

 

I do not know how to setup this submit button to get the aboved action works. 

I have tried patch function, it does not work for me for somereason.

 

Patch('[Stage].[Adv_Advising]',First(Filter('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value )),{Registered_ind:1})

 

Much appreciated!

 

Attachements are the screenshots of the app and table of SQL table.

 

Xiang

 

 

 

Form - PowerApps.png
SQL_table2 - PowerApps.png
SQL_table1 - PowerApps.png
Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @Xiangchen_2019 

     

    Patch('[Stage].[Adv_Advising]',First(Filter('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value )),{Registered_ind:1})

     

    Firstly, First(Filter can be replaced by Lookup (more efficient way)

    Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value )

     

    So your patch can look like:

     

    Patch('[Stage].[Adv_Advising]',

    Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value )

    ,{Registered_ind:1})

     

    Next, check to see if Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value ) matches an item in SQL to update, if it does not find a record, then it cannot patch/update your item

     

    Add a label(for testing only) and set its text property to

    Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value ).StudentID

    If this does not get the student id, that means this function is not returning/matching any item in ur sql table

     

    Alos, Dropdown1.value - should probably be Dropdown1.Selected.Value 

     

    Regards,

    Reza Dorrani

     

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

     

     

  • Xiangchen_2019 Profile Picture
    70 on at

    Hi @RezaDorrani

     

    Thanks for the reply.

     

    May I know for how to setup the Value and text differently in dropdown in powerapps. I only found value as properties of dropdown, not find ID. Not sure where I can pas the event_id in dropdown?

     

    Thanks a lot,


    Xiang 

    dropdown - PowerApps.png
  • RezaDorrani Profile Picture
    12,145 on at

    @Xiangchen_2019 

     

    Share screenshot of  items property for events dropdown

     

     

  • Xiangchen_2019 Profile Picture
    70 on at

    sure, see attachment

    dropdown - PowerApps.png
  • RezaDorrani Profile Picture
    12,145 on at

    @Xiangchen_2019 

     

    If you try dropdown.Selected. (intelicense should show your other properties associated with the data source)

    try it out

     

  • Xiangchen_2019 Profile Picture
    70 on at

    RezaDorrani ,I got ID listed after I try dropdown.Selected. . But I do not know where to assign the dropdown list ID to be the event_id from SQL table?
     
    dropdown 2- PowerApps.png
     
     
     
  • RezaDorrani Profile Picture
    12,145 on at

    @Xiangchen_2019 

     

    Patch('[Stage].[Adv_Advising]',

    Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.Selected.event_id)

    ,{Registered_ind:1})

     

     

    This should enable you to do the patch

  • Xiangchen_2019 Profile Picture
    70 on at

     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

     

    It keep saying not the same type.

     

    formular - PowerApps.png

     

  • RezaDorrani Profile Picture
    12,145 on at

    Hi @Xiangchen_2019 

     

    Add a label(for testing only) and set its text property to

    Lookup('[Stage].[Adv_Advising]',StudentID = StudentID.Text and event_id = Dropdown1.value ).StudentID

    If this does not get the student id, that means this function is not returning/matching any item in ur sql table

     

    Did u try this?

    with your query

    Is it returnign a value?

  • Xiangchen_2019 Profile Picture
    70 on at

    Hi @RezaDorrani ,

     

    I have tried lable, the formular throw the error too.

    see screenshot:

    formular2 - PowerApps.png

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 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard