How to access list after sorted using webviewer

I used the webviewer to sort a list as shown on https://puravidaapps.com/snippets.php#2sort and in the screenshot of the blocks below. I am able to run the sort and display the sorted list. But I am having trouble manipulating the sorted list. I want to be able to use the sorted list by accessing and changing elements in the sorted list. I have set a new variable for the sorted list to equal to the returned result from the WebViewer. Then I tried to retrieve a specific element but I am getting a runtime error that the operation select list item cannot accept the argument for the sorted list. I have copy and pasted the error message below along with the screenshot of the blocks.

Runtime Error Message:
The operation select list item cannot accept the arguments: , [A,B,,,( C ),,(0 0 0),1,K,M,,,( D ),,(0 0 0),5], [1]

Hello Jimmy

'My List' consists of seven Lists, hence the failure of Select List Item. So, why do you have such a complicated arrangement?

Hello Chris,

I'm trying to sort and manipulate a list of list. I was following the example from this link https://groups.google.com/forum/#!msg/mitappinventortest/pVA3VUMN5W8/pZLttKYl3-8J that sorts a list of lists.

That method probably won't work with the complicated list structure you have.

It looks like I can sort the list but I can't seem to manipulate the list. Is there another method that you would recommend to sort and manipulate a list of lists?

You mean "your" list/s....

I was able to display WebViewer1.ContentPageTitle as a label text and it shows up as "myList" sorted. Then I wanted to manipulate the sorted "myList" but I think I need to store that in a variable so I stored it in a variable called SortedList. Then I tried to access an element in the list as a first step to use elements from the list.

the result after sorting is not a list, but a row in csv format, see also the example, which sorts by the 2nd item Redirecting to Google Groups

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

How do I convert the row in CSV back to a list?

my guess is, you want to convert it back into a list of lists...
the first step could be to convert the csv row into a simple list using the list from csv row block, but then you will have to use a for each item in list loop and build the list of lists manually again... sorry, there is no simple conversion block available...

Taifun

Hi Jimmy

We do not know why you are handling your data this way.

  • Is your example the real data?
  • Why are you arranging List Blocks in this way?
  • What happens from there - do you need to display the data as a List?
  • Is the data fixed or dynamic?
  • Is the User just viewing or selecting?

If you give us an understanding of what the App must do, we may be able to give you a better way to do it.

I basically want to have an app capture data for several categories from a preset list characteristics in each category for an individual. I would start out with a single individual with several characteristics to record. Some of the characteristics have several sub-characteristics. After I have filled out the data for one individual I want to be able to repeat the process to capture data another individual by adding another individual. Once I am done entering data for the individuals I would like to be able to recall the specific elements to display or edit. I would also like to sort based on selected elements.

I am trying to rebuild the list as you described. But I am getting the error message "The operation select list item cannot accept the arguments: , [(K M N O (P D Q R) S (58 12 3) 5 A B D E (F C G H) I (22 543 54) 1)], [K]"

These are the blocks to sort.

These are the blocks to rebuild the list.

image

Hi Jimmy

You could use multiple separate lists, one for each category and one for each sub category - but surely the easiest solution is to build a database.
Check out the database extensions on Taifun's website:
https://puravidaapps.com/extensions.php

I suggest reading about the relational data model.
It will give you a simpler and easier to sort set of tables.

sometimes you have to redesign your app...
in your case let me suggest to use the local sqlite database to store your data
doing like this, you can create queries to filter and sort your data as you like ...

You can find my paid sqlite extension here App Inventor Extensions: SQlite | Pura Vida Apps and some free alternatives you can find in the extensions directory here App Inventor Extensions | Pura Vida Apps

probably interesting to read:

why you might want to consider buying rather than taking the “free lunch”

  1. my extension is available since August 2016 and is therefore very stable
  2. it follows the KISS principle - Keep it simple, stupid
    KISS principle - Wikipedia
  3. I’m offering support in case there are issues and provide updates and bugfixes

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.