# How to enter many input variables in Pluto without triggering a full calculation each time

**URL:** https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196
**Category:** Pluto
**Tags:** plutoui
**Created:** [December 16, 2021, 11:08am UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196 "2021-12-16T11:08:56Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 11:08am UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/1 "2021-12-16T11:08:56Z")

</div>

A very basic question, so I apologize if it’s been dealt with elsewhere - I did look.

Suppose I have some function f(x1, x2, x3, x4, …) that is compute intensive and takes a long time to return. How can I enter specific values of x1, x2, … (some are strings, some are dates, some are numbers) without triggering a full calculation of f every time I type a number in the NumberField box for x1 or use a Select dropdown to choose a date for x2, etc.?

It would not be a problem if each change to a variable halted everything and began a new calculation of f (or all dependent cells, more generally). But that doesn’t seem to be the case: If the Pluto notebook is opened with f(x1 = 0, x2 = 0, …) and I first set x1 =1 and then set x2 = 1 it seems to be the case that Pluto first evaluates f(1,0,…) fully before evaluating f(1,1,…).

This feature, if there isn’t an easy workaround that I (an admittedly unsophisticated user) don’t know about, makes Pluto impractical for many important real-world uses of Julia…

Any help here, O Wise and Wonderful Plutoverse?

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [December 16, 2021, 11:28am UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/2 "2021-12-16T11:28:52Z")

</div>

[https://github.com/JuliaPluto/PlutoUI.jl/pull/164](https://github.com/JuliaPluto/PlutoUI.jl/pull/164) might be what you’re after?

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 11:36am UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/3 "2021-12-16T11:36:07Z")

</div>

Wonderful, thank you.

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 7:25pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/4 "2021-12-16T19:25:49Z")

</div>

Any further guidance on how to use the combine method? I can’t find the required @htl anywhere and am unclear on what to do. As per the example, I’d love to use a single confirm call to wrap a bunch of NumberFields and Sliders because if I bind and confirm each widget separately then I trigger a separate valuation with each push of the confirm button.

---

<div class="post-metadata">

### Author: ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)
#### Post date: [December 16, 2021, 7:51pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/5 "2021-12-16T19:51:12Z")

</div>

there are various examples here in these docstrings:  
[https://github.com/JuliaPluto/PlutoUI.jl/blob/13df12b9d6748652d2c512b6f53d274470d36407/src/Combine.jl#L270](https://github.com/JuliaPluto/PlutoUI.jl/blob/13df12b9d6748652d2c512b6f53d274470d36407/src/Combine.jl#L270)

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [December 16, 2021, 7:56pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/6 "2021-12-16T19:56:25Z")

</div>

> I can’t find the required `@htl` anywhere

That macro comes from the `HypertextLiteral` package, you’ll need to import that into your notebook. You might not need `@htl` though if you’re not wanting to do anything fancy, the markdown macro `md""` might be enough for your needs:

```julia
@bind output confirm(
	PlutoUI.combine() do bind
		md"""
		1) $(bind(Slider(1:10)))
		2) $(bind(Slider(1:10)))
		3) $(bind(Slider(1:10)))
		4) $(bind(Slider(1:10)))
		"""
	end
)

```

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 7:57pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/7 "2021-12-16T19:57:50Z")

</div>

Thank you both. Got it now… I guess the docstrings are my friend :\<

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 9:08pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/8 "2021-12-16T21:08:57Z")

</div>

So now I have it working well in a small test notebook. But in the larger notebook for which I want to control calculation I get this error (the rest of the cell shown is long but properly constructed). Any thoughts?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/8/d8cbd7c58b7ae47fe15621ece97c10896cf2c1f5.png)

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 16, 2021, 10:34pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/9 "2021-12-16T22:34:48Z")

</div>

Sorry for the windup. Apparently one of the other packages also had a combine method. Everything works as it should when I’m explicit and use PlutoUI.combine and PlutoUI.confirm.

Thank you both again for your help.

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [December 16, 2021, 10:41pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/10 "2021-12-16T22:41:20Z")

</div>

Probably `DataFrames.combine` and `PlutoUI.combine` conflicting.

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 19, 2021, 5:22pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/11 "2021-12-19T17:22:28Z")

</div>

Apparently, I was overly optimistic… The code that uses Pluto.confirm and Pluto.combine works in some notebooks but not in others. There is a problem above and beyond the conflict that arose from not specifying the PlutoUI package for the confirm and combine methods:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/f/8fb1d0fe0b4285a7f437da6f73ccc0ae7ef6efed.png)

Any suggestions?

---

<div class="post-metadata">

### Author: ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)
#### Post date: [December 19, 2021, 5:41pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/12 "2021-12-19T17:41:14Z")

</div>

you don’t need to qualify confirm, only combine: [https://github.com/JuliaPluto/PlutoUI.jl/blob/main/src/PlutoUI.jl#L41](https://github.com/JuliaPluto/PlutoUI.jl/blob/main/src/PlutoUI.jl#L41)

 ![Screen Shot 2021-12-19 at 12.38.17 PM](https://global.discourse-cdn.com/julialang/original/3X/b/c/bcb9ed751ecb031551ed27d8011f8bd225cf3ba1.png)

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 19, 2021, 5:52pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/13 "2021-12-19T17:52:33Z")

</div>

Fair enough, but not the root problem:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/7/8700835ccef9a1e672b5842c28eef59c16c40f04.png)

---

<div class="post-metadata">

### Author: ![sashmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sashmit/32/18791_2.png) [@sashmit](https://discourse.julialang.org/u/sashmit)
#### Post date: [December 19, 2021, 6:15pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/14 "2021-12-19T18:15:58Z")

</div>

how are you importing plutoui? perhaps posting a tiny MWE notebook including the “using” (or import) statement would be good.

also, sometimes there is additional logging statements in the terminal window where you started julia and pluto that reveals more.

---

<div class="post-metadata">

### Author: ![adannenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adannenberg/32/7869_2.png) [@adannenberg](https://discourse.julialang.org/u/adannenberg)
#### Post date: [December 19, 2021, 7:15pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/15 "2021-12-19T19:15:12Z")

</div>

Here’s the relevant snippet from the larger notebook that shows the error as well as how I import PlutoUI. You are right that I could have been doing that wrong and should have included it in the original screenshot. I will try to construct a small notebook that illustrates the problem. But I doubt that I will be able to, as I have another notebook for which the identical snippet shown works fine (it differs only in the Children being combined inside the do statement). Additionally, there are no errors or useful logging info displayed in the terminal from which the Pluto notebook was launched (screenshot also attached).

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/3/43baecb2eadd67f7e89318ad18e8dcb5f029fc8a.png)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/b/4be1d57f3b2830acf1b5ca5027fb9a362d6e591a.png)

---

<div class="post-metadata">

### Author: ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)
#### Post date: [December 19, 2021, 8:06pm UTC](https://discourse.julialang.org/t/how-to-enter-many-input-variables-in-pluto-without-triggering-a-full-calculation-each-time/73196/16 "2021-12-19T20:06:08Z")

</div>

Some more alternatives to the original question:

1. Use the cell deactivation feature to deactivate your long-running cell, then update all inputs and activate the cell again.

2. Define all input variables as `ref`s, e.g.

```julia
const x1 = ref(0.0)
const x2 = ref(0.0)

f(x1[], x2[])

```

This way, changes in the `x1, x2` values do not trigger execution of `f`. For triggering it, you may e.g. a button.
