# Auto Increament issue under child table

**URL:** <https://forums.knack.com/t/auto-increament-issue-under-child-table/13735>\
**Category:** Get Answers\
**Created:** [February 3, 2023, 10:13pm UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735 "2023-02-03T22:13:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EITS](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@EITS](https://forums.knack.com/u/EITS)\
**Post date:** [February 3, 2023, 10:13pm UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/1 "2023-02-03T22:13:14Z")

</div>

Hello,  
I have a parent table which has the

1. project.ID,(primary key) (we have many projects)

My child table has multiple rows of…

1. purchase transactions
2. Transaction number

…against each project ID

I need to add auto increament on “transaction number” field. when I add the auto increament field in my child table, Knack takes all the available records into account.

This is how I need to show it

project ID TNP001  
Transaction# 1 Purchase amount $ 1000  
Transaction# 2 Purchase amount $ 800  
Transaction# 3 Purchase amount $ 230

project ID TNP023  
Transaction# 1 Purchase amount $ 1996  
Transaction# 2 Purchase amount $ 345

How do I auto-increment values on transactions connected to project ID. I need this to repeat if it is for different project ID. Any idea how to do it? Any help would be appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Brötz](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/wolfgang_br%C3%B6tz/32/1465_2.png) [@Wolfgang\_Brötz](https://forums.knack.com/u/Wolfgang_Br%C3%B6tz)\
**Post date:** [February 3, 2023, 11:25pm UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/2 "2023-02-03T23:25:57Z")

</div>

Hello EITS,

in my experience, you could get TN numbers starting from 1 by

1. adding a “Count Transactions” field in the (parent) Projects table
2. adding an Equation field named "Count + 1"with the formula ‘“Count Transactions” + 1’ in the Projects table
3. adding a trigger field in the Projects table which inserts a connected record in the (child) Transactions table setting the “Transaction Number” to “Count + 1” pulled from the Projects table.

Does this work for you?

---

<div class="post-metadata">

**Author:** ![EITS](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@EITS](https://forums.knack.com/u/EITS)\
**Post date:** [February 7, 2023, 5:30pm UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/3 "2023-02-07T17:30:11Z")

</div>

@Wolfgang_Brötz Thank you for helping, but it didn’t work. I had data already in my database and we have a transaction# field which we manually populate. I was asked if we could add a new transaction# field that auto populates. Attached is the screenshot of two columns side by side. One is the old field which will need to be deleted in future and the new field will calculate the transaction# and populate it going forward. (right now it looks wonky.)

 ![Parent child transaction number with markings](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/0/0f49e929a90ac09d475b2cb41add0c3816d6bced.png)

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Brötz](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/wolfgang_br%C3%B6tz/32/1465_2.png) [@Wolfgang\_Brötz](https://forums.knack.com/u/Wolfgang_Br%C3%B6tz)\
**Post date:** [February 8, 2023, 12:50am UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/4 "2023-02-08T00:50:09Z")

</div>

Hello EITS, sorry to read that it did not work. Not sure if i understand your issue correctly. Can you express the relationship between the old field y and the new desired field x as a function x = x(y)?

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [February 8, 2023, 4:17am UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/5 "2023-02-08T04:17:56Z")

</div>

Hello,

I think first you need to clear old records or need to handle that number manually.  
After that, you need the below steps.

1. Create a count field in the Parent object  

2. Create an equation field in the child object.  

3. Create a number field in child object and add condition rule as below  

4. Create formula field  

5. Result  

AutoNumberTemp is just for internal use(to update Auto Number once) don’t use it’s as unique it’s only showing count after sometime.

Regards,  
Sunny Singla  
[ssingla1985@gmail.com](mailto:ssingla1985@gmail.com)  
+919855089359

---

<div class="post-metadata">

**Author:** ![EITS](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@EITS](https://forums.knack.com/u/EITS)\
**Post date:** [April 27, 2023, 1:00pm UTC](https://forums.knack.com/t/auto-increament-issue-under-child-table/13735/6 "2023-04-27T13:00:31Z")

</div>

Thank you Sunny, We were not allowed to delete old files for now. But it is good to know that it can be done.
