# How to parse a list and retrieve items the contain a specific property?

**URL:** https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231
**Category:** Questions about Thunkable X
**Tags:** beginner, lists, listview, help, advanced
**Created:** [October 13, 2021, 6:48am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231 "2021-10-13T06:48:32Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 6:48am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/1 "2021-10-13T06:48:33Z")

</div>

@muneer @tatiang

Hi, I hope you are doing well.

I have quite a complex logic problem in my app that is seriously stumping me. Essentially, I would like to design an algorithm which parses a list and retrieves a list item that contains a specific property eg. a word.

This is for my school planner application. I have an ‘homework assignments’ screen in which users can enter assignments. Additionally, I have a timetable screen which displays lessons that the student has for that particular day. What I would like to happen is when the user clicks a text item on the timetable, the app displays the tasks associated with that lesson.

Currently I am storing the homework assignments in a list like so:

 ![Screen Shot 2564-10-13 at 13.40.51](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/f/7f98bfe98dcf91a39f0058fc333da61ffafad728.png)

My timetable screen looks like this:

 ![Screen Shot 2564-10-13 at 13.43.24](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/283837dfac7f134664656790683bf22fbda96661.png)

So essentially, I want it so that that when the user clicks say ‘computer science’, they list viewer displays all the computer science tasks. So how could I design an algorithm which parses the assignments list and retrieves all the items that contain the words ‘computer science’ and then display them on the list viewer?

I am sorry if I have not explained this very clearly. Please feel free to ask for any clarification and I will try my best to explain. Any help would be greatly appreciated. Here is the link to the project:

[https://x.thunkable.com/copy/a2796de8f4238c4af5a107ee63879a82](https://x.thunkable.com/copy/a2796de8f4238c4af5a107ee63879a82)

Thanks!

---

<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: [October 13, 2021, 7:20am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/2 "2021-10-13T07:20:24Z")

</div>

I’m sorry to say I could not find the link in your app between the **subjects** and the **assignments**.

Can you clarify this please?

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 7:58am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/3 "2021-10-13T07:58:01Z")

</div>

There is no link at the moment, I am pretty stuck about what to do.

---

<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: [October 13, 2021, 8:07am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/4 "2021-10-13T08:07:45Z")

</div>

A quick and dirty way to “make” a link is to have another list side by side to the **Assignments** list which stores the `index` of the selected item in **Timetable** in the same position of the **Assignments** list.

Example:  
If a user selected “Computer Science”, you will store the index of this block  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/eb67c206d2ca5d75926343175f763033a11c4362.png)

When the user enters the information of the **Assignment** you will insert an entry in the **Assignments** list and in the same time insert the saved `index` into the subject-assignment-reference list.

This way, you can show the assignments related to any subject.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 8:44am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/5 "2021-10-13T08:44:55Z")

</div>

@muneer  
Sorry I am not sure I understand what you are saying, is it possible to show some blocks on how I can do this? Thanks!

---

<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: [October 13, 2021, 9:15am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/6 "2021-10-13T09:15:17Z")

</div>

Check this quick demo  
[https://x.thunkable.com/projectPage/61669e6b16c2820011182531](https://x.thunkable.com/projectPage/61669e6b16c2820011182531)

Of course this does not save info in database but it will demonstrate how to link a subject to an assignment. You will need the other pieces of code of saving this extra list along with the assignment list to be always in synch.

This is the version of code that I would prefer to do.  
[https://x.thunkable.com/projectPage/6166a603d643930011656e15](https://x.thunkable.com/projectPage/6166a603d643930011656e15)  
This is using objects instead of synched lists.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 10:16am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/7 "2021-10-13T10:16:42Z")

</div>

@muneer

I understand what you are suggestion however, I am not sure how it would work for my case. Currently the user enters the their lessons for the timetable which is then added to a big timetable list. Therefore, how could a list be created with just the lessons as your code has done?

---

<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: [October 13, 2021, 11:27am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/8 "2021-10-13T11:27:23Z")

</div>

When the user selects the lesson to add assignment to it then you grab the lesson name and save at instead of the index. Check for the lesson name instead of the lesson order number.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 11:30am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/9 "2021-10-13T11:30:30Z")

</div>

@muneer

But my timetable is on a different screen, so say if you pick computer science, how would you search through the subjects list to find the assignments related to that subject. Right now it seems like you have suggested one integrated system but my application has two separate systems that need to be linked.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 11:33am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/10 "2021-10-13T11:33:01Z")

</div>

@muneer

This is my assignments screen:

 ![Screen Shot 2564-10-13 at 18.32.50](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/c/fcc61b1b85141c7853d70efdb7c11c6429ee8ed8.png)

---

<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: [October 13, 2021, 11:38am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/11 "2021-10-13T11:38:45Z")

</div>

First of all you will have an `app variable` which means it is accessible from anywhere in the app and not limited to a screen.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/3/137f6d979def2f111293316a8389e2818ff0419b.png)

Whenever one selects a subject, you will save this subject to the `app variable`, in my case, **selectedSubject** and then navigate to the `Assignment screen`.

If you use a list of objects as I demonstrated in the second example then every entry in the list of assignment has to values (the assignment info, and the subject it relates to)

This way you use the function I have in the example to view only the assignment related to the subject.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 13, 2021, 11:57am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/12 "2021-10-13T11:57:12Z")

</div>

@muneer

I think I understand your solution, but I am not sure how to integrate it into my application. Could you show me how you would do it please?

[https://x.thunkable.com/copy/de545da0b04b9d017efec514b03c538dhttps://x.thunkable.com/copy/de545da0b04b9d017efec514b03c538d](https://x.thunkable.com/copy/de545da0b04b9d017efec514b03c538dhttps://x.thunkable.com/copy/de545da0b04b9d017efec514b03c538d)

---

<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: [October 13, 2021, 12:25pm UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/13 "2021-10-13T12:25:17Z")

</div>

I tried to open the link many times but I keep getting empty page. Will try later, maybe it’s an internet issue or design server busy.

Just tried again after 3 hours but still the link does not work.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 14, 2021, 1:55am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/14 "2021-10-14T01:55:11Z")

</div>

@muneer

Try this link:

[https://x.thunkable.com/copy/6beff67002a2ea2fbe0cede595a75d9c](https://x.thunkable.com/copy/6beff67002a2ea2fbe0cede595a75d9c)

I have since tried to add a code which will see if the selected subject is contained in the assignment, however, it is not working at the moment.

 ![Screen Shot 2564-10-14 at 08.54.57](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/b/9b895d940db49442cdc1f742496dd2305edbd9f7.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [October 14, 2021, 2:48am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/15 "2021-10-14T02:48:26Z")

</div>

You’re setting the list viewer’s text items to a single value within your loop. Instead, you need to add that single value to a list and then once the loop has completed, set the list viewer’s text items to that list.

I’m not in front of a computer but if that doesn’t make sense, I can post a screenshot of the blocks later.

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 14, 2021, 2:56am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/16 "2021-10-14T02:56:18Z")

</div>

@tatiang

Like this? I still is not working though.

 ![Screen Shot 2564-10-14 at 09.55.58](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/3/332ce9b390e256bf2f1603c3847e9c171b9ef6df.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [October 14, 2021, 3:28am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/17 "2021-10-14T03:28:12Z")

</div>

Almost! The `in list get #` block requires an actual number, an integer. But you’re giving it `j` which is a list item. So you end up telling Thunkable to see if list item # “Write an algorithm” contains “Computer Science” instead of what you actually want. You either have to use a `count from 1 to x by 1` loop block or… what I would do here is to replace the `in list get #` block with just the `j` block. So it will say `does j contain app variable selected subject`.

By the way, it’s a very minor point but the `= true` block is optional here because the `does contain` block returns true or false. It’s also fine to just check `if [does contain...]` and leave off the `=` block.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [October 14, 2021, 3:32am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/18 "2021-10-14T03:32:36Z")

</div>

Like this:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/6/56c435eea943d18379e962bd3c8dd507e7d55229.png)

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 14, 2021, 4:27am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/19 "2021-10-14T04:27:29Z")

</div>

The code is working however, there is a slight problem with the condition that checks if j is contained in ‘selected subject’. When the ‘timetable’ list was populated, each lesson was saved with its corresponding lesson number eg. Period 3: computer science. Therefore, even if the selected subject is computer science, it will return false as there is a ‘Period 3’ substring in front of it.

I think this will require the ‘get substring’ block however, I am not sure how to implement it. Thank you so much for your help!

---

<div class="post-metadata">

### Author: ![jakeheron](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jakeheron/32/116818_2.png) [@jakeheron](https://community.thunkable.com/u/jakeheron)
#### Post date: [October 14, 2021, 4:29am UTC](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231/20 "2021-10-14T04:29:50Z")

</div>

Never mind, I got it to work:

 ![Screen Shot 2564-10-14 at 11.29.24](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/f/cf314649079c9ad0a3bdf03b3c30c403733c0cfe.png)

[Next page](https://community.thunkable.com/t/how-to-parse-a-list-and-retrieve-items-the-contain-a-specific-property/1559231.md?page=2)
