Issues with visualizing mssql results in listview

Hi all,

I have some data in a mssql table that I query from retool:

As you can see in this case I only have one row, but that shouldn't be a problem for the list-view.

The list-view example in the docs uses an api call, but I'm assuming that a result set is a result set and addressing it's properties should work in the same way. Alas it doesn't seem to be that way. The docs (rest api example) uses {{}} to receive the count for the list item.
As you can see the UI tells me that the length property is undefined. The controls that I've added to the listview are also gone in this instance.

When forcing it to a fixed length (default 3) I try to address the i variable to get the "current row of the iterator" to then visualize the data that I've retrieved, but that isn't working neither.

What am I doin wrong?

So I found out that the data collection is a set of arrays, so each property of the select query is mapped to it's own object property and it actually is an array of that particular property.
I'm now just reading the length of my Id property and this works.

Did I miss something or is this fully correct?

1 Like

Hi @JIF That looks correct! Typically, SQL queries are formatted as an object of arrays, while REST queries often return an array of objects.

You can either reference one of the columns directly, as you have done in your second screenshot, or you could try using the Retool helper method, formatDataAsArray()