Display all items of a dictionary (variable amount)

My app is going to be a supermarket shopping list. I will divide all items in four categories and each category is going to be accessed separately. In order to do so, I could just be placing dozens of checkboxes, but for learning purposes I want to try something different.

I was thinking about creating four dictionaries, each of them representing a shopping category, and make a single screen just to display all itens of a category selected in the home screen (screen1). Now I’m really inexperienced with Kodular and I don’t even know if that approach is possible; do we have a “for item x in iterable y do z” iteration loop? Is it required JS coding? Should I use lists instead (I was thinking about putting icons for each item, and maybe some other fields too)? Am I going to have a lot of trouble managing global variables? I’m open to suggestions!

If you show us your dictionary structrue someone may could hell you…

Have you tried with get value for the key

Of if you have list of all the keys then you can use for each items to the list

I don’t have any dictionary yet. I just wanted to know if it is possible to be displaying n components, being n a variable number (size of the dictionary).

Oh I see that this for each items to the list runs some iteration, but what can I do with a list? Can I create a custom data type with several fields and make a list with it? Or maybe create multiple lists, one for each field?

I don’t think that this is what I’m looking for; I don’t want to search specific values, I just want to create visible components for each element of a collection.

You can use the „keys“ Block in dictionary’s.
From that you getting an List of every Key. This list you can put in the „for each item in List“ and use „get value for key“ with the variable „item“ from the „for each item in List“ Block.

But how do I generate checkboxes (or any other visible component) from the blocks menu? I need to create a button for each item of the list of dictionaries keys.

I think this is exactly what I need. Going to see into it, thank you very much.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.