I just can't find the right words

Assuming I have a [list of items] as a [value] in a {dictionary}, and I type in an item, how do I determine if that item is in the list?
Cheers for any offerings of assistance.


I will try that again, logically it should work.. I will let you know what happened

Nothing... no errors, no appearing lists...

Perhaps you need to reframe your question?

There is a debate as to whether a tomato is a fruit or a vegetable.

Are you looking for something that when given 'Tomato', would return 'fruit' or return 'veg' depending on the school of thought you subscribe to?

That would need a different data structure, a dict with names (Tomato, Kumquat, et as keys and 'fruit' or 'veg' as values.


LOL no, leaving out the philosophical and physiological arguments.... I am just looking to see if one item (regardless of it's genus) appears in a list.

Reading your blocks, it looks like you are doing a shopping list app.

In that case, your purpose to looking for 'already in list' is to avoid duplication in your basket list.

So apply the IS IN LIST to the basket list, not to the various grocery dept lists.

Yes, essentially you are correct. I have a grocery list and can find if an item exists to eliminate duplication. I am currently using dictionaries for the first time to examine their capabilities and hone my lists, listviews etc in, say, a grocery app.

I seem to have upon something, one must extract the [value] and assign it to a list. Cannot IS IN LIST with this, and CONTAINS treats list as a string

SO if you don't care about quantities, your Add button click would be:

When ....Click
  if NOT is in list(global basket, ListView1.Selection) then
    add item ListView1.Selection to list global basket
  set ListView2.Elements to basket
end When Click

Coding is easier when components have purposeful names.

still laughing at the baby launcher....

so, back to basics, going back to the original block, in the FOR EACH block, am I correctly capturing the [value] in [item]? At the IF block, does [item] represent a list of goodies from the dictionary?
(It's the dictionary that discombobulates me... not so much the code)

You are not really using "dictionaries", but a list called fruit and a list called veg.

Just work with those lists and leave out all the dictionary stuff.

Yes, Tim. For this I will, but still curious about dictionaries. What is their ultimate purpose, though? It seems to me to be a convoluted 'tag' in a random access db

Off to do tangible activities now, darts and ale. Will tackle this at a later date, friends. Thanks so far....

Dictionaries work with "json" key /value pairs:

Get key one value = Tomato

But it gets more complicated with more complicated json

They are like TinyDBs (plural), but faster and without the persistence.
A lot of these samples use dictionaries ...

keep dictionaries for single term definitions, and lists as lists.
I can see how the dictionary works well in a JSON object. I will put it down for now, and fine tune my lists.
Thanks for all the help on this subject.

So any good examples and/or tutorials on using the full capacity of a listview, data, main, details and images??


See Video from Susan at MIT

Thanks Tim, for the video link. I will play around with that stuff. Is all the data required at design? or can the data be manipulated during run time?

You can build your listview elements using this block (e.g.):

then you can manipulate the element list

Make certain you set the correct view in the listview properties in designer

Cheers Tim. Gives me sum'at to play with for a while