Flexible table component / Pivot Table

While I’m burning the midnight oil, I’m trying to figure out how to do some performance reporting. The data side is easy, I can eventually get it into a displayable format, but short of stacking text fields in an array or doing some trick with the listview iterating through an array, I can’t figure out a good way (given the current tools) to do something like this:


Having a true pivot table would be terrific but until then having some type of more robust layout for row/column data, like a column component that’s just iterates for a given array for x number of values. You could stack them side by side in a container and assign each of them a different array.

Good question! This is something we should really improve. Right now the strategy is to just drag on a 4x4 of TextInputs. @alex — do you want to add this to our spreadsheet as well? Thanks!

In the meantime, I think I can hack something together by building an object of arrays and iterating over them in listview with the index. I can build the conditional formatting in by concatenating the html to be in the value.

@blue-coat-atc thanks for the feedback here! Adding some kind of pivot solution is on our upcoming roadmap. There is also an undocumented feature of AlaSQL (the library we use to power the Query JSON with SQL resource) that allows you to pivot, but it’s a bit touchy right now.

Tables are such an important component of any data-based tool, that I suspect it’s the core of every Retool app, as well. At the risk of recreating too much of what Excel does, I would certainly welcome the introduction of a more powerful table component. There are a few in the React ecosystem, that are quite powerful and could be extended if necessary.

Apologies for the bump, but I was about to ask something similar when I found this. Is the 4X4 of textinputs still the best strategy?

If so, I’ll add my +1 for this - retool is great for workflow, and I’d love to use it for reporting too. This is easily the biggest missing feature stopping me from doing so.

1 Like

Hi. Just searching on the forum for Pivot solutions and found this so I’ll add my two cents worth (and apologies 'cause I’m a javascript and contemporary web app noob, I was a dev many years ago but of of practice): As mentioned there are a bunch in the ecosystem, like orb.js (although not sure if this is being maintained ).

Is there a way to incorporate this in retool? Could you include it as a library from https://cdnjs.com/libraries/orb, and then include similar HTML, including the javascript in the HTML? Akin to the examples on here?

Don’t really understand how to do this, or critically how the javascript would reference / ‘find’ a retool query.

Anyone with any bright ideas, please shout: Otherwise I’m going to have to create a standalone web app, which uses the same underlylng postgres db, and then put it in an iframe in retool :slight_smile:

At the moment I am literally using MS-Excel, connecting via ODBC to the db but maintaining all the data via retool, as very few solutions are as good as Excel itself, unless maybe you go to PowerBI / Tableau / DataStudio.


bump? any ideas anyone?

Hi there @domjammoo!

My apologies in advance here, but I’m a little lost on your end goal 😅 Are you just looking to include a JS library in Retool? If so, we have a section in our docs on that! https://docs.retool.com/docs/custom-js-code#custom-javascript-libraries--npm-modules

Hey Victoria,

So my js skills are pretty basic and I've had a go at incorporating a library but is a bit beyond my capability level. My use case is : I want a pivot table. If anyone has found any way to do this (including, but not limited to, integrating an external JS library) then it would be really useful to see a worked example. Not hugely optimistic that anyone else will have done this / have the same needs that I have :slight_smile: