# Get rows from data table

**URL:** <https://discuss.elastic.co/t/get-rows-from-data-table/137601>\
**Category:** Kibana\
**Created:** [June 27, 2018, 10:55am UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601 "2018-06-27T10:55:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesusgn90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesusgn90/32/26998_2.png) [@jesusgn90](https://discuss.elastic.co/u/jesusgn90)\
**Post date:** [June 27, 2018, 10:55am UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/1 "2018-06-27T10:55:08Z")

</div>

Hello guys! I'm struggling to get the rows array from a data table visualization.

First of all: I want to avoid making request to elasticsearch from my backend and compose the result by myself cause I think I can reuse the existing data. I know how to fetch the same data and the query to be used but it's not my desired logic.

If I have one or more data tables vis already rendered into my view, Is there a way to get rows from the visualizations handler?

```
EmbeddedVisualizeHandler {
   _element: ...
   _firstRenderComplete: ...
   _listeners: ...
   _scope: ...
}

```

The problem comes from I want to get the a similar content like when we click in download csv content from saveAs.

As I can see here [https://github.com/elastic/kibana/blob/f0cc432fafd6f7053f32d493aba8b576dcb20539/src/ui/public/agg\_table/agg\_table.js](https://github.com/elastic/kibana/blob/f0cc432fafd6f7053f32d493aba8b576dcb20539/src/ui/public/agg_table/agg_table.js)

What I'm looking for is $scope.table.rows, so my question is How to access $scope.table.rows out of the Kibana directive code? I have the visualization object, the handler, etc ..

Thanks in advance,  
Jesús

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [June 27, 2018, 11:37am UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/2 "2018-06-27T11:37:17Z")

</div>

Hey,

there is currently no option via the handler and vis loader to reach the data within the visualization. We are also not planning to add such an interface, since we have no knowledge about the data inside the visualization (if it is even using any), it might not be in a tabular format, etc.

**Dirty workaround from 6.4 onwards! ☢**

There is a dirty workaround, that you can use, if you have access to the `Vis` instance, which I don't recommend and this might never work in a backward compatible manner. If you've got access to the `Vis` instance of that visualization, you can use the attached data adapter, which is used to log the data for the inspector and get your data from it, something like that:

`vis.API.inspectorAdapters.data.getTabular()`

Which would return a promise that resolves with a table of the data. But since we are not making any guarantee on this API the format might change in upcoming versions (though no current plans to do so).

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![jesusgn90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesusgn90/32/26998_2.png) [@jesusgn90](https://discuss.elastic.co/u/jesusgn90)\
**Post date:** [June 27, 2018, 12:55pm UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/3 "2018-06-27T12:55:02Z")

</div>

Ok Tim thanks for your response. One more thing, Have you got a raw response parser implemented? I need to implement one by myself but I think you could have something into your code which parse an elastic raw response from a data table request...

Thanks in advance,  
Jesús

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [June 27, 2018, 1:59pm UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/4 "2018-06-27T13:59:07Z")

</div>

Hi,

you can try having a look at [`tabify`](https://github.com/elastic/kibana/blob/master/src/ui/public/agg_response/tabify/tabify.js) which is what we are currenlty using. But you should neither consider that a public API. In fact we know we'll change the output format in one of the upcoming versions ([https://github.com/elastic/kibana/issues/20197](https://github.com/elastic/kibana/issues/20197)).

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![jesusgn90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesusgn90/32/26998_2.png) [@jesusgn90](https://discuss.elastic.co/u/jesusgn90)\
**Post date:** [June 27, 2018, 2:14pm UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/5 "2018-06-27T14:14:39Z")

</div>

Yep, I was looking into it hahaha. Thanks Tim I'll write here again if I'm facing troubles.  
BTW awesome work with Kibana.

Regards,  
Jesús

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 25, 2018, 2:14pm UTC](https://discuss.elastic.co/t/get-rows-from-data-table/137601/6 "2018-07-25T14:14:41Z")

</div>

Closed on July 25, 2018, 2:14pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
