Tutorial TinyDB to File and back

hey today i have made a little creation thought this may be usefull

it will convert a TinyDB with all tags and values to a text that can be stored as a file and back


if you click a button it will save all tags of you tinydb and there values in a list, then it converts the lists into csv rows ( better to the file back to an Tinydb) and adds a ! between them so we later can split them
this will be safed as a file when the button gets clicked

if you press the file to Tinydb (in my project the read button) it will get the file it then splits the text at the !
after that it converts the csv rows back to two normal list (tags, values), these will then be safed back to the tinydb

this might be usefull for games where the player wanna backup there stats

will soon be available in my new App :makeroid:

AIA FILE tinydbtofile.aia (4,4 KB)

4 Likes

You dont need to make your full post in Bold

4 Likes

Hey man, I am having some trouble replicating your “invention”. I can’t find the to do procedure with the “text” next to it. //lower right part

Please let me know where I could find it.
Thank’s

you have to write the custom procedures yourself
http://appinventor.mit.edu/explore/ai2/support/blocks/procedures.html

btw. there also is an extension…
Get all TinyDB Extension by Juan Antonio to backup TinyDB as Text or JSON format
see also the extensions directory App Inventor Extensions | Pura Vida Apps

Taifun

Hey Taifun,
That’s what I am doing, I am in the last patches of replicating the procedure, I’m not looking for a copy paste easy way out.
This is what I’ve done so far: for the two procedures.

you might want to elaborate, what exactly you are talking about…
a screenshot would be great…
Taifun

Basicly, I figured out how to get the blocks to work so that the button starts a barcode scanner app, and I want the result of the barcode to be stored in a DB, and than to be pulled out as text.
This is the work in progress:


The left side makes it so that for now, the only message I get is QR not recognised, but I haven’t gotten to make it work propperly, due to the roadblock in the TDB_to_Text procedure, that’s why you still see the “text” tag.

don’t you want to store the result from the scan in TinyDB?
currently you are storing the namespace of TinyDB, which does not make much sense, does it?

and inside the BarcodeScanner.AfterScan event add a
set Textbox.Text to result
and you do not need the 2 procedures from the right at all

also the textbox components inside your TDB_to_Text procedure do not make any sense…

Taifun

Basicly, in the end app, I want to compare the result of the scan to a DB of “unique items” and to display the property of each item. But for now, just getting to display the result of the scan would be great.

Mihai

see my edited previous answer
Taifun

@Taifun I just realised my mistake.
In a very poor naming decision, I was considering the QR as the barcode scanner, instead of the button I was defining it to.
Sorry for the trouble.

This post was flagged by the community and is temporarily hidden.

Boss, mere replacing tags in this file will make it work?