Try different variable name, like Sample.
Hello Şener - welcome to the forum!
You cannot use 'name' as the name of your List, it's a reserved word.
In the "select list item" Block, you should enter the name of the List, not "get item". However, I'm not sure that's even the correct Block to use.
Well, although select list item would normally require a List as input, the Help documentation does direct us to use the key item. I thought that might be a typo but in fact it works:
ListSort.aia (2.3 KB)
? "item" is a sub-"list" of the main list
That makes sense :sunglasses
(but a new Block using the word "sub-list" instead of "item" would be self-explanatory)
Delete all assets from the Companion app of your test device, reload browser, re-connect Companion and try again.
Version : 2.65
Update Companion. Version 2.66. Worked. Thank you.
but some time it's not a list, maybe a number ,a string or Dictionary.
Not for the specific Block, it is only for Lists? I just think that calling a List (sub List) 'item' is confusing in the context of this Sort.
On the plus side, at least the Documentation has working examples - that should be true for every Block and every Component.
The block iterates over the items in the list. In this particular example, those items happen to be lists, but as @Kevinkun points out a list in App Inventor can contain anything. For example, if you were trying to sort a list of components, it wouldn't make sense for us to call the variable sublist, because the items are components. For many operators on lists we tend to use item as a generic placeholder, e.g., for item in list.
Note that the item is renameable in context, so it would be advisable (but not required) to rename it to something that makes sense for the purposes of code readability. On the other hand, it's basically App Inventor's equivalent of using
i as an iterator in loops in a text language.
- it is a Sub-List of components. I did show that 'item' can be renamed..... but perhaps the Help Document could show that.
I'm not sure where you are coming up with this idea of a sublist. For example, in these blocks item will be an instance of TextBox:
And the resulting output of the block will be a new list where the text boxes are ordered based on the values of their text.
There is a more simple Block for that sort.....?
Ah no, it doesn't sort by the text.... but the List could be TextBox text.