I think I need a clever solution. I want to create a table that is pressCount in one column and timeSincePress in another. I’d do it as below, but cellContent won’t take variables as inputs. I may be missing something obvious – any help would be appreciated! Thanks.
Is this what you have in mind? I’m new to cl myself but I thought I could tackle this one (with a lot of c&p from the examples, lol).
Just for anyone else in general, (unless it’s changed) cellContent() doesn’t accept variables. You always have to enter a specific row and column so
cellContent(a1,1) doesn’t make sense to the program.
Thanks! However – what I’m struggling with is keeping the data. So it’s a table with multiple rows.
Column one is the number of the click, column two is the number of the last click.
My 1984 programming brain is having trouble figuring out how to store the old data. Once I get a value for, say, click 1, how do I store it in a variable or a table so that it doesn’t change? What’s new to me is the way CL recalculates everything all the time, so if I say a1=button.timeSincePress(), I need to somehow NOT have it do that for a1 next time, but for a2 instead. I only need about 6 presses, so I can do them individually. Here’s the kind of table I mean:
Thanks, Daniel. I saw that in a previous post of yours from a while ago – saved me some frustration! (Would be nice if it worked, though.)
Just discovered lastValue – I think I can make this work!
I figured it was more complicated than that… lol! Please report back if you work it out. I’ve been sitting here fiddling with it, and I haven’t managed to make it work yet. (I should be doing other things, but I enjoy these puzzles, lol!)
I did kind of figure it out. Not sure I completely understand what I’ve done. Here’s a link:
It’s meant to gather data about reading speed. Essentially, it captures the last timeSincePress and stores the new one.
I don’t quite get the difference between Capture(“a1”) and a1=. . More investigation needed.
It will help to see what’s going on if you delete the hide commands in my different components.
Thanks for helping – let me know if you have any further insights!
Oops… I think you did not publish the finished version. That link is going to a basically “blank” activity. (This took me some time to figure out too, lol… if editing a draft, until you click “publish”, none of the changes are pushed to any shared version).
Sorry about that. This should work. I added an intro description with a little explanation.
This is really great! I don’t fully understand all the “capture” code and how it works. These are the things I want to get better at! Thanks for sharing! I’m going to save a copy to refer to when perhaps I can understand it better, lol.
So, you actually did more than you needed to. a1 is a variable that, depending on how you define it, can change. capture(“a1”) creates a list of values for each time the button is pressed. You alternatively could’ve done this:
Note: I’m using “this” to reference the current component instead of “click”, and I created “L” so I didn’t have to keep using “this.history(“time”).elementAt(#)”
I thought I was doing too much. Thanks again – your explanation is clear and concise too.