How do I access the filtered data of a table

+1 , thanks!

+1 here as well

+1 for displayedData please and thanks

Add me plus +3 for .displayedData on new table

Same here +1

Hi all,

We shipped a method for getting the displayed data of the table :blush:


This would be incredibly useful. I'm trying to use it, but it doesn't appear to work properly. It doesn't return anything.

I can't get this to work either.

getDisplayedData() seems to return an empty object in all cases when called from a JS query

The "control component" dialog seems to do nothing either, where is it the response/data supposed to be accessible?

Not displayedData property on the table before or after running the function either.

Very confusing and frustrating :frowning:

Hmm interesting :thinking: Thank you for flagging! I'm not able to reproduce this issue yet. Would you mind sharing a screenshot?

Confirming it's not working for us either. Data is displayed in the "Output" view of the query editor but when you try and transform the data in any way, it doesn't work.

I think I've figured it out - I knew I must be doing something wrong, it's a promise!

So if I console.log(table1.getDisplayedData()) it shows {} in the console
If I create a function that assigns a variable to table1.getDisplayedData() and console.log it, it's also {}.
Same problem if I'm running a function where I'm used getDisplayData as an argument, it fails because it's receiving a {}
If I await table1.getDisplayedData(), however, it works.

Perhaps the example works using the dummy data in the table because there's a small number of rows and the timing is not noticeable. Using 600 rows (as I am) means I have to await the response.

My solution is this:
let filtered_data = await table.getDisplayedData();

Thanks for the nudge @Tess I knew there must be something I was missing.


Ah ha! That explains it. It wasn't obvious it was a promise.

Ah, right! Thanks so much for posting this, @dcartlidge!

And thanks all for the feedback -- will see if we can get some tooltip or linting to make this more prevalent

1 Like

Genius, thank you!

I am trying to use this function to update a chart to reflect the filtered data set after letting the user filter by date range. I tried putting table1.getDisplayedData() into the data source, but it does not recognize the function. Any recommendations here?

Hi @ppperkins You'll want to use getDisplayedData in a Javascript query or event handler.

One way to solve this would be to have a variable as your chart's data source. The variable can be set to the table's data property by default. Then, that variable gets updated (using setValue()) with the displayedData after the user filters the data

Thank you for the help, Tess.

1 Like

Amazing feature! It works perfectly on my side, now I won't have to maintain a parallel filtering function anymore :slight_smile:
Many thanks

1 Like

table1.getDisplayedData() doesn't work in a transformer only in queries and scripts. Can we get that fixed?

Hi @Josh_Bullough I'll add your +1 to the internal request, but I'm not sure where this falls on our roadmap yet

For now, I'd recommend using a JS query so that you can fetch this data only when needed