# Add new row to DataGrid with sequential ID

**URL:** <https://community.weweb.io/t/add-new-row-to-datagrid-with-sequential-id/10437>\
**Category:** How do I?\
**Tags:** workflows, supabase\
**Created:** [August 25, 2024, 9:18pm UTC](https://community.weweb.io/t/add-new-row-to-datagrid-with-sequential-id/10437 "2024-08-25T21:18:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiara](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kiara/32/10172_2.png) [@Kiara](https://community.weweb.io/u/Kiara)\
**Post date:** [August 25, 2024, 9:18pm UTC](https://community.weweb.io/t/add-new-row-to-datagrid-with-sequential-id/10437/1 "2024-08-25T21:18:25Z")

</div>

Hey there, just wondering how I can correctly add new rows to the DataGrid element, where the ID for the newly added row follows sequential order based on ID’s that currently exist.

For example, I have 2 rows in my table with ID #1 and ID #2.

I have my action setup on a button to insert a row in my database when clicked.

In the ID section what formula do I use so that it would create the new row with ID #3?

Currently I have this: **rollupSum(Pricelist.Data,‘id’)** which doesn’t work well as it calculates all of the ID values found and then adds for example #5 and then #10 to my database.

I tried to use the build in AI but it keeps outputting things that end up with “max is undefined” etc.

It’s probably so simple, but I am not really familiar with formulas like this. Any help will be so appreciated 🙏
