# How to link a Selector to a column of a DataTable

**URL:** <https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723>\
**Category:** New to Julia\
**Tags:** control, data\
**Created:** [April 4, 2025, 5:03pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723 "2025-04-04T17:03:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![edmund.r](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmund.r](https://discourse.julialang.org/u/edmund.r)\
**Post date:** [April 4, 2025, 5:03pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723/1 "2025-04-04T17:03:48Z")

</div>

Hi,

I have some JSON of the form

```
 j = JSON.parse("""[{"A":"one", "B":2},{"A":"three","B":4}]""")

```

I have made a DataTable by

```
 dt = DataTable(DataFrame(j))

```

Next I would like to bind a Selector control to a column. I can get a column but it is of type `DataTable{Vector{String}}` but the control needs type `Vector{String}`; it needs `Vector{Any}` and `String` will work. However, I cannot get the column as `Vector{String}` out of the DataTable.

For example, with

```
 selector_col = dt[!,"A"] 

```

`selector_col` is of type `DataTable{Vector{String}}` and I can’t extract type `Vector{String}`.

```
 Vector{String}(dt[!,"A"])

```

gives an error

```
 MethodError(Vector{String}, (DataTable{Vector{String}}([... the column list I want ...], ...]

```

Which I think means there is no cast defined from `DataTable{Vector{String}}` to `Vector{String}`.

How is this done or am I going about it the wrong way?

Thanks

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [April 4, 2025, 6:38pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723/3 "2025-04-04T18:38:46Z")

</div>

DataTables.jl is [deprecated](https://github.com/orgs/JuliaData/repositories?q=DataTable).  
Could use the DataFrame directly or is there something from DataTables.jl that you really need?

---

<div class="post-metadata">

**Author:** ![edmund.r](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmund.r](https://discourse.julialang.org/u/edmund.r)\
**Post date:** [April 4, 2025, 6:47pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723/4 "2025-04-04T18:47:50Z")

</div>

The project is in Genie Builder which needs DataTable for its tabluar data visualization controls. I could hold 2 copies of the data in memory (DataTable and DataFrame) but I’d prefer not to for all the standard reasons. Would the column pull be the same for DataFrame but return `Vector{String}` type?

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [April 5, 2025, 1:59pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723/5 "2025-04-05T13:59:42Z")

</div>

Yes, `df[!, :A]` produces a view of the data vector.  
Unfortunately, I don’t anything about Genie Builder. It should be possible to get the elements of the DataTable out one by one and assemble them into a Vector (unless you need a view). But I don’t know how to do that, and the code given in the DataTables docs does not run (not a good sign!).

---

<div class="post-metadata">

**Author:** ![edmund.r](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@edmund.r](https://discourse.julialang.org/u/edmund.r)\
**Post date:** [April 7, 2025, 2:01pm UTC](https://discourse.julialang.org/t/how-to-link-a-selector-to-a-column-of-a-datatable/127723/6 "2025-04-07T14:01:24Z")

</div>

Thanks for having a look. I’ve reach out to the Genie Builder support team. Will see what they have to say.
