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

Hello, i'm trying to create an app for vehicle management.
I created a list which includes: id, date, vehicle, item from listpicker (like refueling, lubricant service, tire replacement, brakes replacement etc), km/miles, price, reminder and notes. All are joined in the list separated with comma (,).

Now i want to split this list and take 4 items (date, vehicle, item and price) to join them in a new list for listview or listpicker. I want to create a "summary" from each record and when user clicks on it (in listview or listpicker) full record displays in a label.

I'm doing something wrong, because the result is or only the last record, or records with the same "summary" e.x. vw, lubricant service, 55€. After a lot of testing new problem appears (select list item cannot select item 3 of list of 1).

Split procedure has data, but join procedure not.

I'm novice in app inventor and i learned a lot from your answers in this community.
Thanks in advance.

Hi johnl

The List per_date contains more than one item (more than one vehicle), so you cannot split that List at a comma, only it's Items. Select the Vehicle of interest via it's List Index, and split that Item to separate all the data of that specific vehicle.

1 Like

See the SELECT and WHERE_EQ value procedures in this sample ...


You can compose them by feeding the output of one call into another procedure call's parameters.

1 Like

Thank you for your answers. I will examine them and I'll inform you.

Regarding your vehicle identification,
be aware that every vehicle has an industry standard unique Vehicle Identification Number (VIN) on its windshield and in its engine compartment.

There's no need to generate your id numbers at the vehicle level.

Service activities logging is a different matter, though.

1 Like

I think you're right. I created Id field at the begining. Later I understood that lists works in a different way than tables. I thought then that every "row" needed unique Id. My difficulties with lists are that in my mind I have tables. In lists every item is a row correct? And for columns maybe I need one list per column? Or it is better my approach with joined fields separated with comma?

It is a good idea to browse The Relational Data Model to understand the simplest way to organize data into rows and tables.

Spreadsheets like Google Sheets are good places to build and share tables before building apps to access them. Each Sheet would be a simple place to keep a table.

For in-memory table wrangling, see

and

1 Like

Thank you, i need time to read them. I'll let you know the results :muscle:

I think, this is what i looking for.
But i got an error "select list item cannot accept the arguments"

Prove to me that you called the SELECT procedure with a list of lists (a table) in the FROM parameter and a list of column numbers in the COLUMN parameter.

1 Like

You can save items as rows with multiple columns, thus working with your 'table' analogy.

Edit: if you can upload a text file of sample data, say 3 vehicles (can of course be fake, but representative), I can make some sample code for you. Note though, a lot depends on how many records you need to store. TinyDb can hold a few hundred but an SQL database can store thousands. You might also need to store the data online if more than one person needs to access it.

1 Like

ABG, i'm not sure this is what you asked:





ChrisWard here is the sample data file.
My thoughts is that this app is for "service logs", so the user can store a few records. I think that few hundred is ok. Also i think is good that the user can store, retrieve data without internet connection.
Later i must find a way to export and import data from TinyDb for backup or re installation.
I'm not familiar with web services so that i can connect app with sql database.
Sorry for my bad English.
sample_data.txt (530 Bytes)

Hi johnl

If there is an upgrade of your App but it still uses the same records, then the User installs the upgrade App over the existing and the TinyDb data is not disturbed.

Although ABG is right about the uniqueness of the VIN, most vehicle Owners could not look-up a vehicle with a VIN - what they want to use (for look up) is the vehicle number plate - much shorter, easier to remember. If they can't remember the numbers, they would need to be able to input something they know - the make, model, or colour, then select from a "mini list" of vehicles that have the matching attribute.

1 Like

...right. Confused now. Who exactly is the User? Someone who owns the vehicles or a Service/Repair garage? Either way, it looks as though you need to store several service records for each vehicle. That is the realm of a relational database. Trying to do it with lists of lists for storing in TinyDb is kind of hazardous :thinking:

1 Like

Maybe my english is the cause of misunderstood.
App is for single users that they want to keep logs, notes about their car service, insurance etc.
Example: i have 1 car and in the app i can enter all the information and obligations about my car. The date of last service, the date for the next service, date insurance policy starts and ends, date of tire replacement, next replacement, date of last refueling, prices of them etc. Like a car agenda. Like service book but with more "items". There is no need for more fields like vin or plate. All records are for my car. If i have 2 cars then i can separated them from the field "vehicle" (example: vw, audi, seat, polo, golf, or whatever user wants to write (free text)). Now, if user has 2 cars of the same brand he can separated them with text (ex. vw1, vw2, or polo1, polo2 etc).
That is also the reason that i think TinyDb is enough for that app.

...but it isn't johnl, it isn't. You also do need to be a bit more formal with identification because all databases rely on that key information. As an aside, most Users would need a record of both VIN and number plate, they are often critical when ordering parts.

Edit: I need to have a coffee and a good think about your requirement :owl:

By the way, your English is very good, no doubt about that.

1 Like

Different vehicles in my code is for testing.
This is for vehicle owners.
I need a list with all the fields (date, vehicle, "item" (i need a better explanation for this), kn/miles of the vehicle (example lubricant service at 55.000 km), price, reminder (example: next lubricant service), notes (free text).
Then i need a way i can choose a column (example reminder) so i can create a new list to sort per reminder, or create a list for fuels (cost by month etc).

I do this for my vehicles using a spreadsheet, one sheet for each vehicle, in the form of a log. Future items are part entered, and everything is routinely date sorted. Free text columns allow for notes and comments and a cost tally is maintained to keep an eye on total costs of ownership. Could easily be transferred to an app.

1 Like

Can you show us how Tim? There is definitely something wrong with my coffee, hasn't helped me think of a good solution at all. The goalposts have moved somewhat since johnl's first post :grin:

1 Like