# Adding values from Listview to a List without duplicates

**URL:** https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834
**Category:** Questions about Thunkable X
**Tags:** solved, beginner
**Created:** [February 25, 2021, 12:23am UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834 "2021-02-25T00:23:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![busybuzzybots](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@busybuzzybots](https://community.thunkable.com/u/busybuzzybots)
#### Post date: [February 25, 2021, 12:23am UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834/1 "2021-02-25T00:23:30Z")

</div>

Hi, I am new to Thunkable and am exploring Lists and List views, however, I am stuck and would appreciate help on the below scenario. This is what I am trying to achieve :  
I have a ListView- Symptoms with the items - S1, S2, S3, S4, S5  
When the user clicks on an item I want to store the item in a separate list - " Selected Symptoms"  
However, before I add to this list I want to check if the item exists in the list and add ONLY if it does not exits, if it exists then it should get removed from the Selected Symptoms list.  
Here is the logic I am following however this does not seem to work and I am seeing the items added multiple times and they are not getting deleted

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/3/d3d81f30988b63039877d87a702d041dc96479a0.png)  
Note: I have another listview L\_Sel\_Symp - to display the items from the “Selected Symptoms” list.

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [February 25, 2021, 12:42am UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834/2 "2021-02-25T00:42:02Z")

</div>

Start with removing the blocks and checking back in. When you use that if “variable selectedSymptoms” is already designated as a list (which I’m assuming it is) you essentially have a list that is 1 item in a larger list (remember an array can be made of arrays) your blocks make a resulting array like this…

```
[ //main array
   [1,2,3], //subarray 1
   [4,5,6] //subarray2
]

```

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [February 25, 2021, 1:30am UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834/3 "2021-02-25T01:30:48Z")

</div>

You have defined `SelectedSymptoms` as a list so you should not append the `list` block to it.

You don’t need this

 ![Screenshot_20210225_042741](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/46f2e504a1602b579fbee72e12fdd31689c08b8f.jpeg)

You also don’t need the `else if` because you are testing the same condition.

---

<div class="post-metadata">

### Author: ![busybuzzybots](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@busybuzzybots](https://community.thunkable.com/u/busybuzzybots)
#### Post date: [February 25, 2021, 4:18pm UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834/4 "2021-02-25T16:18:55Z")

</div>

You all are amazing!!! I did not even think about the list within the list 🙂  
I removed the " List" block and adjusted the elseif to just if and it works perfectly!!! Thank you !!  
here is the updated code

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/2/c27346e28aac78644b0a259c38d4d874ed4571e1.png)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:29pm UTC](https://community.thunkable.com/t/adding-values-from-listview-to-a-list-without-duplicates/1122834/5 "2024-11-08T13:29:14Z")

</div>


