# resetOnChange but keep history

**URL:** <https://cl.desmos.com/t/resetonchange-but-keep-history/4164>\
**Category:** Questions\
**Created:** [March 19, 2022, 5:24pm UTC](https://cl.desmos.com/t/resetonchange-but-keep-history/4164 "2022-03-19T17:24:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmin](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jmin/32/3468_2.png) [@jmin](https://cl.desmos.com/u/jmin)\
**Post date:** [March 19, 2022, 5:24pm UTC](https://cl.desmos.com/t/resetonchange-but-keep-history/4164/1 "2022-03-19T17:24:30Z")

</div>

Hello,  
I have successfully figured out how to use resetOnChange in a button to wipe out a table but I’m also trying to keep a summary of previous attempts. Is this possible? I’m still a newbie in CL. Here’s my activity (I’m trying to make screen 4 work):

> **[Unit Circle • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/622b9f01c49e6d48409b71e3)**
>
> Self-correcting unit circle
> \*beware of latex

TIA!

---

<div class="post-metadata">

**Author:** ![pirsquared](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pirsquared](https://cl.desmos.com/u/pirsquared)\
**Post date:** [March 19, 2022, 6:57pm UTC](https://cl.desmos.com/t/resetonchange-but-keep-history/4164/2 "2022-03-19T18:57:29Z")

</div>

Assuming that “c” and “g” from Graph 2 are the variables you want to keep a history of, then you can use the button to capture those variables each time it is pressed (ie. `capture("c"): graph2.number("c")` etc.)

Then you can re-access each attempt with `button1.history("c").elementAt(...)`. I haven’t specifically tested this but something like:

```auto
cellContent(1,2): when s<=1 "${button1.history("c").elementAt(1)}" otherwise ""
cellContent(2,2): when s<=2 "${button1.history("c").elementAt(2)}" otherwise ""
cellContent(3,2): when s<=3 "${button1.history("c").elementAt(3)}" otherwise ""
cellContent(4,2): when s<=4 "${button1.history("c").elementAt(4)}" otherwise ""

```

should be what you’re looking for.

---

<div class="post-metadata">

**Author:** ![jmin](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jmin/32/3468_2.png) [@jmin](https://cl.desmos.com/u/jmin)\
**Post date:** [March 21, 2022, 4:01pm UTC](https://cl.desmos.com/t/resetonchange-but-keep-history/4164/3 "2022-03-21T16:01:46Z")

</div>

Thank you again!!! I added in the ${button1.history(“c”).elementAt(1)}" in the otherwise “” or else the row was blank with each new attempt. I learned that from your other post 😄
