Combine Two Lists in One Listviewer

In response to this question from Jason, here’s a quick demo of how to concatenate two lists into a single ListViewer.

Here’s the remix link in case you want to experiment with this yourself:
https://x.thunkable.com/copy/eff5d510394e9c7e3a8db660070f2fc3

1. Prepare your two lists

Your lists can contain anything you like, and the data can come from users/firebase/localDB/airtable - it’s completely up to you really.

34

2. Create your variables

In this example we’ll use

  1. A variable for the concatenated strings, called tasks
  2. A variable to keep track of where we are in our list, called index
  3. A variable to separate the first string from the second string, called delimiter

43

3. Create your concatenated list

Here’s a function the loops through the input lists and joins the second to the first, with the delimiter of your choice in the middle.

Note that we also use the to UPPERCASE block to further emphasise the difference between the task name and the task description

4. Display the list in a ListViewer

voilà!

53

3 Likes

Ok.
But it’s voilà, not violà :rofl:

2 Likes

Hi,

Is this still relevant? i have tried your project but nothing happen.

It works for me:

2 Likes

how to create this?

return end of block and has app task on it.
image

The return section of that function block is there because it’s a “to do something and return” block. You can read more about those here: https://docs.thunkable.com/functions.

The basic idea is that you run some code (blocks) within the function and then return a value. Some of the most common real-world examples of functions are found in math (sorry if you already know this!). The “multiplication” function takes two numbers and returns their product. So when we say “what is 8 times 3?” we are referring to the function that adds 8 to itself three times and returns 24.

2 Likes