Problemas com Consulta SQLite com retorno e. List_view_text_and_image

Hello people.

I have a DB in SQLite that has two columns “id” and “class”.
When calling a certain Screen I want to create a new List_View_Text_and_Image.
And that they possess in Title and Subtitle the respective fields.

I am able to call the data and create the list_view_text_and_image.
However, the data is being “replicated.”

For example: let’s say there are 5 records in the DB with the Id of 1 to 5 and their names (Mauricio, Carla, Katia, Neto, Paula). He is creating the 5 List_View_Text_and_Image, but plays the same information
For each of them.
It’s like,

(1, 2, 3, 4, 5)
(Mauricio, Carla, Katia, Neto, Paula)

(1, 2, 3, 4, 5)
(Mauricio, Carla, Katia, Neto, Paula)

(1, 2, 3, 4, 5)
(Mauricio, Carla, Katia, Neto, Paula)

(1, 2, 3, 4, 5)
(Mauricio, Carla, Katia, Neto, Paula)

(1, 2, 3, 4, 5)
(Mauricio, Carla, Katia, Neto, Paula)

I am returning the above data but should return:

1
Mauricio

2
Carla

3
Katia

4
Neto

5
Paula

Does anyone know the best way to do this, either with “For each” or “While” ??

1 Like

As you have shown no blocks, I can only guess.

My first guess is a query problem. I would suggest you go to this tutotiral on Appybuilder, and use their sample aia file. Play around with it.

https://help.appybuilder.com/components/reference/advanced/sqlite

As well check out the examples here.

https://puravidaapps.com/sqlite.php

1 Like

With the standard SQL component something like this:
screenshot_122

In this case rowid is the “image” of a single listview item: it’s a nonsense. Obviously you must adapt the query.

After reading better your request, you only have two values in the table. So you have to re-iterate the resulting list and then you can use the addItem method to build the listview (or you can build the final list of lists and add multiple items with the already mentioned above method Add Item From List)

Hello rbnet_it
how can I do to show a specific column of the select without changing the sentence “select name, mark” … "?

Are you using the frdfsnlght/aix-SQLite extension? If so, the query result is a list of lists, so you have to reiterate the “item” in the for each block and then you can access the elements of the final list with the “select list item” block.

screenshot_179

i will try. thanks

hello good night, I tried two ways, but none worked.
You already used this extension, I’m lost.
this two links is a images in that two ways.
[Imgur: The magic of the Internet] [Imgur: The magic of the Internet]

Sorry, I haven’t been very active lately because currently I have not a valid device that allows me to test the blocks quickly (someone has stolen my Note 8…).

You can try something like this:

You can avoid using local variables field1,field2,field3, I put them only to make the structure more clear, but they might come in handy if you need to process the single values returned by the query.

Maybe there’s a smarter way to retrieve the query data, but even that should work.

Sorrry, on the last For Each, listItems should be finalList.

Hello, my friend, thank you very much for your help, my difficulty has been practically solved, except that the listview is showing “()” symbols, I tried to change the “start” to 3, but still it does not remove the “(” symbol, but remove “m”.


You have to understand the components you are using. For the listview you need a simple list and not a list of lists (as for Listview image and text).

Try something like that:

thanks, this is solved