Cannot save on tag "1" after deleting this tag from list

Hi people, i’m having a problem and cannot solve myself :frowning: in my app i make a list of saved data, they are listed in labels and tags , so if i save first time, this data go to tag “1”, if a save again, the data go to “2”, and so on…but when i delete the first tag (tag “1”) i cannot save again in this label, they save on the tag “3” and leave the tag “1” empty, how i can save again in tag “1” if i have a data already saved on tag “2”?

I hope you guys understand, is hard to explain and i don’t find similar example in YT

Hi,

To “Initialize” block add Tiny_DB1.Clear All.

If you want to write data to the number that it had after deleting the Tag, then you have the wrong algorithm. Tag number is assigned based on the total number of Tags in the list. If Tags.length = 10, then after removing Tag with number 1 the next Tag will have the number 9 and will overwrite the information in it.

I just don’t wanna leave a blank space on the first “labels” where i save the first tag, the number of the tag itself doesn’t make difference for me.

Maybe is better to remove the item from list?..how can i do that?..i tried and failed :frowning:

If i use “clear all” they worked, i’m able to save again on this “tag”, but i have to lose all the saved data in the others tag to.

If i clear the tag “1” and “2” individually, then i’m able to saved again on the first tag.

Sorry, I did not express myself clearly. You need to clear tags only the first time to be sure that there is no garbage in the Tiny_DB. After this delete block Clear All from project.

I’ll try to explain my whole project, maybe is more easy with the whole scenario:

I’m making a scale with 4 load cells in arduino, then by bluetooth i send the data to my app, this part is complete, but i wanna be able to save the “sessions” on a list with a length of about 20 “saved sessions”, this saved sessions opens in another screen, i tried listpick and listview, but they show all the data together on the same line, and the way i show here i can show the data on labels.

So, what’s the better way to store this saved data on labels?

PS: This blocks posted here is only a test, with only two textbox to colect the data to save.

Edit: I’m trying to copy this:

Use a delimited string for this. You write to the first line of the session and after the end of the recording, add a unique separator character to the end of the line, for example #. After that, you add the next session to the line and at the end add a delimiter #. After writing the last session, delete the last character in line #. You will get:

session data 1 # session data 2 # … #session data 20

After that, you can break this line into a list by the symbol #. Do you understand such an algorithm?

4 cells = 1 session? If so, then your data string will be: cell1, cell2, cell3, cell4 # cell1, cell2, cell3, cell4 # cell1, cell2, cell3, cell4, etc.

To be honest i’m noob on this algorithm, but if this is the easy way, i will search for this.

Yes, four cells in 1 session, and there’s more, there’s some math to calculate % and weigth of only 2 cells, 4 cells… will be about 12 data to list in one session.

This is a list of lists (or a two-dimensional array. To get a session you have to get the session element from the external list, and to get the value of the cell in it, get a cell from the session item.

I get it!..a list of the sessions, and inside every item of the list, a list of the data, right?

In advance, thanks for your help!

Yes! But you get these lists from one data text line - it’s that much easier.

This way i can use listpicker to chose the sessions?

I’ll try this tomorrow, is 2am here and my head is almost exploding from all this informations LOL.

Thanks!

Yes. If you have any questions, ask me. And I will do for you a block with an example in this topic.

Text in block data = value1,value2,value3,value4\nvalue5,value6,value7,value8\nvalue9,value10,value11,value12\nvalue13,value14,value15,value16

Thank you very much!..i’ll try today, i’m machinist, so this projects is in my spare time :smiley:

Good! I also worked a little with Arduino for Android.

I copy this block to my project, but i don’t get how i input the data from arduino…you said to get the data in this form: ( value1,value2,value3…) directly from arduino?

I’m using the labels and textbox to display the data on the screen1, and do all the math on the app.

I tried someting today and worked!..i’m now saving on file component, i don’t have that problem and i can save with the file name and retrieve using this file name, i just want to make one more thing to be complete, if possible, i wanna to add a listview or listpicker to show the saved files, but just show the “name file”, not the data on the file, is possible?

Thanks again for all the help! :smiley:

I gave the format value1, value2, etc. as an example. It’s good that you made your format and everything works!

To display file names in the List Picker, you need to get these names from the directory in which they are stored. You can do this using the File extension:

https://puravidaapps.com/file.php