# Append Record to List (Xano)

**URL:** <https://community.weweb.io/t/append-record-to-list-xano/691>\
**Category:** How do I?\
**Created:** [June 20, 2022, 9:48pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691 "2022-06-20T21:48:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 20, 2022, 9:48pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691/1 "2022-06-20T21:48:25Z")

</div>

I have a table TEAMS and another table USERS. Each TEAM record can have multiple USERS.

I’m trying to add an action where I can click on a user and add them to a team, appending them with all of the other users already on the team. Right now when I call the record it’s just overwriting any other users already on the team and adding just that one user I select.

Any idea on how to make this work?

Backend is Xano

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [June 22, 2022, 8:33am UTC](https://community.weweb.io/t/append-record-to-list-xano/691/2 "2022-06-22T08:33:24Z")

</div>

You could try using the `add` or `prepend` formulas to add the current user at the end of the array of users you have in Xano:

 ![CleanShot 2022-06-22 at 10.29.39@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/1X/585f19626fd488d55d378c3b878b37882548bd28.jpeg)

When you hover over a formula, you can see a tooltip on how it works.

Let us know if that solves the issue.

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 22, 2022, 11:38pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691/3 "2022-06-22T23:38:01Z")

</div>

Thanks I will give this a shot and let you know how it works.

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 24, 2022, 4:23am UTC](https://community.weweb.io/t/append-record-to-list-xano/691/4 "2022-06-24T04:23:05Z")

</div>

OK so I tried to make this work, but it’s just replacing whatever value is in the field, not adding anything to it. Am I doing something wrong with my Array?

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/1X/8815297cfdba1376a19c34eab87e1e33f0001076.png)

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [June 24, 2022, 1:49pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691/5 "2022-06-24T13:49:50Z")

</div>

Show Team[‘data’][0][‘users\_id’] is not an array. This is the value of the users\_id key.

Item.data[‘id’] is not an object. This is the value of the id key of the current item in the collection.

if you want to add the object to the array/collection, try this: add(show Team,Item.data)

 ![Screen Shot 2022-06-24 at 9.47.52 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/1X/f8d3507c250fce147aa8555e5a0c52f32e022332.png)

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 25, 2022, 3:45am UTC](https://community.weweb.io/t/append-record-to-list-xano/691/6 "2022-06-25T03:45:41Z")

</div>

Thanks Kevin.

So I wanted to add users to the users\_id column, wouldn’t I need to specify the column that row/column I want to add the users to?

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [June 25, 2022, 11:16am UTC](https://community.weweb.io/t/append-record-to-list-xano/691/7 "2022-06-25T11:16:22Z")

</div>

What is the structure of the array that you are wanting to add the team member to?

Is it like this?

Show Team = [  
{“users\_id”:1},{“users\_id”:2}  
]

And you want to make it like  
Show Team = [  
{“users\_id”:1},{“users\_id”:2}, {“users\_id”:6}  
]

Or maybe it’s like this?  
And you want to make it like  
Show Team = Id,…,users\_id:[5,8,6,97]

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 26, 2022, 5:36am UTC](https://community.weweb.io/t/append-record-to-list-xano/691/8 "2022-06-26T05:36:33Z")

</div>

Here is the JSON back from the table TEAMS w/relationship of USERS

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/1X/ec2b97904e511a8e85bd7ef598ad126310a4b06f.png)

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [June 26, 2022, 2:26pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691/9 "2022-06-26T14:26:30Z")

</div>

@patopt

So that I understand correctly … are you just wanting to add the user to the Show Teams array on the front end? Or are you wanting to add the user in the backend Xano?

If you want to add it to the backend, you will need to handle that in the Xano API endpoint. In that scenario you’d want an endpoint that takes the team\_id and the user\_id as inputs, and then does a database transaction where Xano adds a new record to the DB to indicate a new user on the team.

If you just want this to happen on the front end, you can use the array functions @Joyce mentioned above. However, adding a user on the frontend using those functions will not add them to the database.

If you want to add a user to the JSON schema from your screenshot on the frontend, you will want to use something like add(Show Team[‘users\_id’], {id:2,email:“[john@aol.com](mailto:john@aol.com)” … first\_name:“John”,etc,etc})

The JSON above for users\_id is going to expect an object of type user.

Let me know what exactly you are wanting to do and I can provide some more input.

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [June 26, 2022, 11:55pm UTC](https://community.weweb.io/t/append-record-to-list-xano/691/10 "2022-06-26T23:55:44Z")

</div>

Thanks Kevin. I’m looking at adding users in the Xano backend, I just want to update the row/column to add users to that object in the database.
