Is there a problem with trying to clear list?

could be but why would it work when I come out of the app and then go back in?

do you store the new list in TinyDB after modifying it?
Taifun

yeah when the data gathering starts I use the create list to clear the old data. I store the list in the same variable that is now clear and when the data gathering has finished I store it in tinydb.

This is when I first run through the app, the list in global data is empty and I'm storing the data in tinydb under the tag dad,front,10 seconds
image
On the second run through the list in data is showing empty and I'm using a different tag dad, front, 30 seconds. however I'm getting the 10 second data and the 30 second data. What makes me think the global data create list is not clearing is if I build the apk and turn the app off between runs it works fine.

image

You are using a global variable as your tag for your TinyDB READ into your data variable.
How do you know if it is current to what you are looking for?
Could you instead rebuilt the tag on the fly and feed it directly?

I select the tag to be used at the beginning of the app and all the data for that tag is stored at the end. When I have a different tag it should pull up the data stored previously to that tag. And it works when I come out of the app between runs but not if I don't.

a short video of the app running with the device. https://www.youtube.com/watch?v=xSNyEu2Kt04

Just checking ... The bolts don't run clear thru the head, right?

Any way, so it looks like you are collecting data and graphing it on the fly.

Is there a Start button for initialization, or are you using a Screen.Initialize event for that?

The screen initializes and you select the trainee and exercise and duration which will be the tag. When you press start the objects on display turn to false and the graphing part turns to true.

more pics,image

Do you want to keep a historical record of this, or are you going to reuse that tag every time he does this exercise again?

the tag for the trainee and exercise and duration stays the same and the data gets saved in a long list of lists which I get then compare.

Your screen shot of the Do It results gets too fuzzy under magnification to read.

There is a way to prepare a sharp download, using the block level Download as PNg right click option.
Download the setTag procedure, hopefully with the comments intact, and we should be able to read all those Do It comments in our Blocks Editors.

Don't edit the .png file otherwise it will break the importability.

I don't know if this will be related to this problem...

I extracted the Do It texts from your two global variable captures into Notepad files:
tagForStart.txt (40 Bytes) data.txt (2.0 KB)

The contents of the data global variable have varied over time in content and shape.,
with identifying fields mixed in with numerical readings.

Are there multiple processes (Clock Timers, other sensors) triggering insertions of data at irregular times out of your control?

there are four clocks but there all triggered one after the other. Like I say it works when i come out and go back in which makes me think the global variable isn't really emptying.

I've turned off the autosave in the google drive still doesn't work.

Just found out I don't have to leave the app it works fine when I go to another screen and then come back to screen one. I still think the global variable data isn't really clearing unless I navigate away from screen one.

I'm sorry.

I read your code over the major part of a bag of chips and some dip, and I can't hold its inner workings together in my mind to trace it all, especially that data variable with its lumpy structure, all those global variables roaming free, and those procedures that exert all their influence through side effects.

If you can't find someone with more headroom, there are techniques you can use to untangle the app, involving local variables, procedures that accept parameters and emit values, and structuring of data into dictionaries.

I'm sure there is. I still don't know why it works when you leave screen one though.

I thought of one more way to get into trouble with lists of lists (tables) ...

AI2 lists are linked lists.

If you don't take care, you might find yourself with tangled list references in memory, that won't untangle until you clear them and reload from an external data store like TinyDB.

I have found the AI2 copy list block helpful in doubtful cases where I want to grab content from a list but leave the original list undisturbed. (I did not see any use of that block in your code.)

Here is a proof of the inner workings of AI2 lists:

1 Like