Skip to main content
Community site session details

Community site session details

Session Id : DZDLR33HN1YK3BHNiodVUG
Power Apps - Building Power Apps
Unanswered

Adding row to database with power apps

Like (0) ShareShare
ReportReport
Posted on 12 May 2023 10:30:49 by

Hello everyone,

 

I am a newbie trying to develop some applications in power apps so bare with me it this is just for you guys a stupid question 😅

 

I have a table on a database with let's say 3 columns:

id which is a serial primary key

A which is a varchar column

B which is a numeric column

 

I have seen that I can easily edit one of the columns with a form and a button by using the function collect (please share your knowledge and tell me if there is a better one 😁)

 

Now my problem is trying to add a new row. Whenever I try to add a new row. If I add to the form and to the button to add the id column with collect it tells me the function is not valid. On the other way, if I leave it, it tells me it is missing. 

I am most likely sure it has to do with it being serial but not sure how to write it or configure it to accept new entries. Any help would be welcome!

 

Thank you!

  • mmollet Profile Picture
    3,187 on 12 May 2023 at 21:35:41
    Re: Adding row to database with power apps

    First things first.... There are no dumb questions! This forum is here for people to learn from and I learn something every day that makes me think well duh I should have knows that! xD It's par for the course in any type of programming so please by all means dont feel stupid! In 6 months you will be answering questions like me on here 🙂

     

    Collect Function: Adds records to a data source. Can be SP, SQL, Dataverse, Local collection, etc...

    ClearCollect Function: Completely clears the data source THEN adds the records to the now empty collection

    Clear Function: simply clears all rows from the data source passed to it.

    Patch Function: Can be used like collect to add to a collection but can also be used to edit a specific row in a data source. (this is what the submitform functions use. You will sometimes get an error saying patch function failed when using a submitform function and this is why)

    SubmitForm Function: This function simply submits the form for you. the form can be a new form or an edit form and the function will dictate which it should do. (add new or edit based on form mode)

     

    Try something simple first to get used to how it works. Drop in a button and on the OnSelect Property of that button use the following code: 

    Patch(YourSPListName, Defaults(YourSPListName), {Column1: "somevalue", Column2: 15, Column3: "another value"})

    This should add a row to your database within a second or two. Let me know if this helps! I might be slow responding as I am getting ready to be off work but I will respond tonight at some point! 🙂 good luck!

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473