Updating text based on info in a datatable

I am new to retool, and am primarily a gsheet/excel user.

I am trying to update texted based on information on a data table. Currently I am working on an attendance tracker, where I can mark employees as "Present", "Absent", "Late", etc. I'd like to create a little blurb that says I have X employees working from 11am to 9pm, and so on. I am not really sure how to go about that. Does anyone have any recommendations?

Hi, welcome to the community

Your best bet would probably be to write a Transformer to gather the data you want in the format you need. You can then point the text area at the Transformer to display the text.

Grouping and sorting the data will be the next step - if you have access to the query data you can write multiple javascript functions to traverse the data array and sort/group/filter as you need. There's a bunch of really handy lodash functions built into Retool to help with this as writing it all in pure javascript can be a bit daunting.

I've made a quick and dirty example, using the dummy data table.
It counts the number of people within each different role and turns it into a pretty string, same with counting the number of teams each person is in.
You'll see that each function is "wrapped" around another function, same as you would in a spreadsheet formula. So you might filter the data, then sort the data, then group the data, then sum the data, then concat some strings around each line of data.
It might give you some ideas of where to look next.

forum.json (65.2 KB)

1 Like