# \[Solved\] Return result depending items selected (combining variables)

**URL:** <https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881>\
**Category:** Questions about Thunkable X\
**Tags:** solved, localdb\
**Created:** [March 24, 2021, 1:24pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881 "2021-03-24T13:24:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![4-1-22-8-4](https://avatars.discourse-cdn.com/v4/letter/4/258eb7/32.png) [@4-1-22-8-4](https://community.thunkable.com/u/4-1-22-8-4)\
**Post date:** [March 24, 2021, 1:24pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/1 "2021-03-24T13:24:19Z")

</div>

The app has 3 Screens (Screen1, Screen2 and Screen3).

On the “Screen1” the user clicks on an item on a “List Viewer 1”. The item that was chosen is Updated on the Local DB “choosed” in the the cell in the column1 and rollNum 1.

On the “Screen2” the user clicks on an item on a “List Viewer 2”. The item that was chosen is Updated on the Local DB “choosed” in the the cell in the column2 and rollNum 1.

![Captura de Tela 2021-03-24 às 10.13.05](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce3f3341767a993df6b183f6179026d72d60d4b1.png)

On the “Screen3” the Label"s text is configured to return a result based on the itens choosed on the Screen1 and Screen2. The result is configured on a Local DB table called “final” (column1 and column2 has a combination of itens chooses on the previous Screens and column3 has the result that based on the itens choosed).

![Captura de Tela 2021-03-24 às 10.08.08](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/c/4ca2f5e3ec6001020dcfd02e44ec5a1effe9a0f2.png)

I can’t return the final result simply because I can’t fill out the form of “rowNum”.

 ![Captura de Tela 2021-03-24 às 10.17.05](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/f/3f6bd99de700c4533c27dcc99bd7f86780466170.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:** [March 24, 2021, 1:49pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/2 "2021-03-24T13:49:26Z")

</div>

Are you connecting to Local DB using the Data Sources method or the component method?  
Depending in which one the blocks are different to get the rowNum.

---

<div class="post-metadata">

**Author:** ![4-1-22-8-4](https://avatars.discourse-cdn.com/v4/letter/4/258eb7/32.png) [@4-1-22-8-4](https://community.thunkable.com/u/4-1-22-8-4)\
**Post date:** [March 24, 2021, 1:55pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/3 "2021-03-24T13:55:22Z")

</div>

I am connecting to Local DB using Data Sources.

---

<div class="post-metadata">

**Author:** ![4-1-22-8-4](https://avatars.discourse-cdn.com/v4/letter/4/258eb7/32.png) [@4-1-22-8-4](https://community.thunkable.com/u/4-1-22-8-4)\
**Post date:** [March 24, 2021, 1:56pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/4 "2021-03-24T13:56:33Z")

</div>

@muneer I am connecting to Local DB using Data Sources.

---

<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:** [March 24, 2021, 2:02pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/5 "2021-03-24T14:02:39Z")

</div>

You need to use this component to get the list of RowNums in your Local DB  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/8/18de930b38f17c936dbf7c71719e3463a59d6d7e.png)

There is a hidden column name “ID” which you need to use  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/7/0754101605761aaaea68e15ceea3315345edf156.png)  
This will give you a list of all row IDs which are 32 Alaphnumeric characters.

You will then need to loop thorough the rows to select the row that fits your criteria.

**[Edit]**  
Check this sample project for the technique  
[https://x.thunkable.com/projectPage/5fb9fb1dbfeb240011084d78](https://x.thunkable.com/projectPage/5fb9fb1dbfeb240011084d78)

---

<div class="post-metadata">

**Author:** ![4-1-22-8-4](https://avatars.discourse-cdn.com/v4/letter/4/258eb7/32.png) [@4-1-22-8-4](https://community.thunkable.com/u/4-1-22-8-4)\
**Post date:** [March 24, 2021, 3:13pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/6 "2021-03-24T15:13:46Z")

</div>

@muneer It doesn’t work or I didn’t understand.

I need the text of the Label

 ![Captura de Tela 2021-03-24 às 12.08.19](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/e/8e08604533e6b368e553478a9ba2d0ec86cef646.png)

The text of the Label is automatically filled based on a predefined result in the column3 of the following image:

![Captura de Tela 2021-03-24 às 10.08.08](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/c/4ca2f5e3ec6001020dcfd02e44ec5a1effe9a0f2.png)

The result is given depending of the itens chooses of the previous Screens (the combination of itens choses in the 2 previous ItemViewer are in the image of the Local DB above).

---

<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:** [March 24, 2021, 5:48pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/7 "2021-03-24T17:48:22Z")

</div>

It would be best to share your project link so we can see the real issue.

If you feel you don’t want to share it publicly, then you can PM someone you trust to troubleshoot the problem.

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [March 25, 2021, 2:13pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/8 "2021-03-25T14:13:47Z")

</div>

Hi there,

You can use an **and** block from the Logic drawer of blocks to combine to if statements.

For these blocks, your first selected value and your second selected value have to match the first two columns of a given row for the app to return the third value as your result.

 ![Screen Shot 2021-03-25 at 2.12.40 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/f/3ff2ab3f621cec468cd9fc7ff9f45b06bf1d5424.png)

You can view this project [here](https://x.thunkable.com/projectPage/605c94d1a4064f0011b4719f/).

---

<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:** [March 25, 2021, 2:29pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/9 "2021-03-25T14:29:18Z")

</div>

Very nice work @jane  
This is my version. I sent it to the user in PM  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/6/c6eb3257ec536ae5be6a575d9b759b666ce859b5.png)

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [March 29, 2021, 11:59am UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/10 "2021-03-29T11:59:57Z")

</div>

Well snap! You also accommodated the possibility that no match could be found, while my blocks do not.

@4-1-22-8-4, It looks like Muneer presented a great answer here, so I’m going to mark it as the solution for your original question. If you have further questions about how these blocks work, feel free to follow up with them here!

---

<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:25pm UTC](https://community.thunkable.com/t/solved-return-result-depending-items-selected-combining-variables/1184881/11 "2024-11-08T13:25:47Z")

</div>


