Need help with split items from list and merge them in another list

I thought that i can do it. But i have problems, maybe from list utils extension.
Once i sort the list, i can't select from list and the tables show each result in one line with ().
My main problem is to select some of list item to create a new list.
As i said i want to sort by date (with format yyyy/MM/dd) and create a new list with the remain items from the sorted list, or a method to hide item from table.
You can see it in your project. I include list utils extension in it.
CarMaintenance_SORT.aia (39.0 KB)

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks including Do it results...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


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

1 Like

WIth Tims' instructions, it works fine.



When i try to sort the list, i get error:

and the result is sorted but in one line without comma and without cells (cause the missing comma) and with () .

Now if i try to make a new list

I have this error:

With make a list in golballogs1:

I have this error:

Just a suggestion to make everything easier to manage, why not use dictionaries instead of the lists, you might find the error by doing so.

1 Like

A couple of issues:

  1. Your date sort format. It needs to be yyyy/MM/dd for every entry, these are strings (texts) not numbers. Therefore 2021/1/1 will sort differently to 2021/01/01. make sure all you sort dates are completely filled like this: 2021/02/25.

image

  1. Use Do it to understand what your data looks like at each stage. this will help you find the problem

image

1 Like

I wish a happy new year to all of you.
My issue is Solved. Issues caused by list utils extension.
I tried @abg sort method and with @TIMAI2 code i managed to select list items and create new list with the items i want.
Thank you very much all of you for your time and your efforts to help me .
forum-01-00-001


One last thing that i want is to select record from tables view for editing or deleting. I didn't find a way so far.

Use this block ( I did include this in my example) to get the entire row or cell

component_event

1 Like

Thanks again :slightly_smiling_face:

You are sorting a three level deep structure.

You did not show your customized precedes() function.
Are you sure it compares the proper fields?

1 Like

i didn't change anything in your blocks.
In all my tests it sorts list the right way, by vehicle (list1, index1) and then by date (list2, index1).

@TIMAI2 how can i find list index from table?

in the block:

image

"row" should return a number that relates to the index, it may be 1 out due to the header row.


What i made wrong?

Hmmmm

possibly removing items from a list in memory (the reversed list) will not work ?

Try setting the reverse list of global logs to a variable first. Then when the item has been removed from that variable list, reverse that list again back to global logs before saving to tinydb.

image

1 Like

I have just looked again, you are trying to set an index with an item

image

1 Like

@TIMAI2 you're right.
This fix it.

I have another problem. I created 6 "tabs" (buttons) with vertical arrangements in each one.
Vertical arrangements opens and close from button_tabs.


Button_tab_1 and button_tab_3 (add new record and add vehicle), works fine
If you click button_tab_2 (record tables), new vertical arrangement opens and it have 3 more button tabs (button_tab2_1, button_tab2_2 and button_tab2_3(per date, reminder, fuel)).

Button tab 1 (add new record) calls spinner 1, button_tab2_1 (per date) calls spinner 2, button_tab2_2 (per reminder) calls spinner 3 and button_tab2_3 (fuel) calls spinner 4 to select vehicle by licence plate.

Result is table1 in every tab button_tab2_1, 2_2 and 2_3 with different lists.

It works fine. When i'm in button_tab2_1 per example and press button_tab_2 ((record tables)(for display again the 3 "sub tabs")) i can switch between "sub tabs" ((when i click button_tab_2 (record tables) it close table and opens vertical arrangement of "sub tabs")). After 2 or 3 switches i receive runtime error select list item:Attempt to get item number 0, of the list .... (vehicles)

Blocks of tabs are:

How can i eliminate error?

My guess is that at some point a list selection block is expecting a list to select from and not getting one. You will have to debug to find out which one and where!

You may need to simplify things, test, then add a bit more, then test again. It looks complicated :slight_smile:

1 Like

I solve last error (select list item:Attempt to get item number 0, of the list .... ).
When a table is up, i close all the remaining vertical arrangements and I put a button close table.
If you click it, it refresh the page (close page and open same page).
Error gone. :smiley:

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