# Retrieve variable in component for another component

**URL:** <https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016>\
**Category:** Discussion\
**Created:** [February 4, 2022, 7:01am UTC](https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016 "2022-02-04T07:01:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genise\_Forde](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/genise_forde/32/3063_2.png) [@Genise\_Forde](https://cl.desmos.com/u/Genise_Forde)\
**Post date:** [February 4, 2022, 7:01am UTC](https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016/1 "2022-02-04T07:01:10Z")

</div>

I am working on making an online assessment for one of my elementary teachers. She wants to have students “show” what a fraction is. for instance 4/5. I would like to make a slider where students can set the denominator of the fraction bar. I have all of the pieces but I can’t figure out how to pull a variable from one graph and make it a variable for another. Can anyone help me??

> **[Fractions assessment • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/61fccd2fe660df0a5f215332)**
>
> This activity offers starter screens that you can copy and paste into your activities. These screens are intended to help you create tasks about fractions for your students.
> 
> To copy a screen, open the screen you want to copy and then press cmd+c (on...

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 4, 2022, 7:24am UTC](https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016/2 "2022-02-04T07:24:51Z")

</div>

To set a variable in a graph from a variable, n, within another graph (here named graph1):

```auto
number(`n`): graph1.number(`n`)

```

They can be different variable names if desired.

---

<div class="post-metadata">

**Author:** ![sergeballif](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sergeballif/32/231_2.png) [@sergeballif](https://cl.desmos.com/u/sergeballif)\
**Post date:** [February 4, 2022, 9:08pm UTC](https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016/3 "2022-02-04T21:08:00Z")

</div>

Just in case, I’ll expand on Daniel\_Grubbs’s answer by pointing you to the documentation which shows where to place your code. [Computation Layer Documentation](https://teacher.desmos.com/computation-layer/documentation)

---

<div class="post-metadata">

**Author:** ![Genise\_Forde](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/genise_forde/32/3063_2.png) [@Genise\_Forde](https://cl.desmos.com/u/Genise_Forde)\
**Post date:** [February 5, 2022, 7:01am UTC](https://cl.desmos.com/t/retrieve-variable-in-component-for-another-component/4016/4 "2022-02-05T07:01:44Z")

</div>

Thanks guys! So simple!
