Rendering a Row Number for each Row in a Table

Background:
I am currently working through a retool application and am looking to the community for help.

The application is searching through State & County information and returns specific information based on search criteria. The response-data includes information which is ranked in ascending order based on a "filing date" (date-time value).

Goal:
I would like to add an iterative Row Number to the retool table which has a list of dates. For example, if I were to search for "Company ABC" and receive a response of 5 different dates, sorted in Ascending order, I would like to earliest date to have a Row Number = "1" and the lastest date to have a Row Number = "5"

Details:

  1. I've already set the retool table to prevent any table-sorting functionality in order to preserve the Ascending date time of the response-data
  2. I only need this Row Number to be rendered client-side, there is no need to store this information in the backend.

Question(s)

  1. Does Retool allow for a table configuration where an iterative Row Number is assigned, starting at "1" and calculating up to "n" (where n = total number of rows in the table)? If so, what does this configuration look like?

Hi @springstreet,

I think you should be able to achieve this by adding a new column to your table.

image

Click that plus button, and then you'll see the column options.

Settings like this for the column should get you what you're looking for.

image

Basically, "Label" it whatever you want and set the value to {{ i + 1 }}, which is a variable Retool makes available for each row of the table - it's the index, the other value is {{ item }} which is the actual content of the row. The index is 0 based, so your first row has an index of 0, hence the +1 which will make it look like it starts at 1.

Thank you - I figured it was something this easy, but didn't see any solutions posted online.

1 Like