# @eval with Observable in Interact

**URL:** <https://discourse.julialang.org/t/eval-with-observable-in-interact/50054>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [November 12, 2020, 2:58pm UTC](https://discourse.julialang.org/t/eval-with-observable-in-interact/50054 "2020-11-12T14:58:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hagi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hagi/32/3678_2.png) [@hagi](https://discourse.julialang.org/u/hagi)\
**Post date:** [November 12, 2020, 2:58pm UTC](https://discourse.julialang.org/t/eval-with-observable-in-interact/50054/1 "2020-11-12T14:58:02Z")

</div>

Hi,

I have a problem with Interact, where I don’t understand what is wrong. I have the following MWE.

I have a csv file with several columns that might look like this:

```julia
Result,A_Result,B_Result,C_Result
10,1,3,4
12,3,4,5
12,3,7,8
23,5,7,8
23,4,6,8

```

I want to plot the results and use interact to switch between the columns.

```julia
using CSV
using Interact
csvdata = CSV.File("test.csv")

parts = [:all,:A,:B,:C]

ui = @manipulate for part in parts
      if part == :all
             result = csvdata.Result
      else
            println(part)
            @eval result = csvdata.$(Symbol("$(part)",'_',"Result"))
      end
      p1 = plot(result)
end

```

The :all column works fine, but for the other columns it doesn’t and I get an error `(UndefVarError: result not defined)`.  
The issue appears both in IJulia notebook and when I use Blink.

If I remove the if-else block and do it like this:

```julia
using CSV
using Interact
csvdata = CSV.File("test.csv")

parts = [:A,:B,:C]

ui = @manipulate for part in parts
      @eval result = csvdata.$(Symbol("$(part)",'_',"Result"))
      p1 = plot(result)
end

```

It works as expected.  
Am I missing anything?

I am using julia 1.5.3  
hagi
