Looping over query results in Business text Panel

I am trying to display the values from a query in a table that I have created using html in the content section of the text panel. But if the query returns more than one value another table structure is being created to display that value instead of displaying it in one table. Is it possible to display the values in a single table structure?

Please post your content section code here?

Content Section code:

<thead>
    <tr>
        <th style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">Car Name</th>
        <th style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">Speed</th>
        <th style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">Manufacturer</th>
    </tr>
</thead>
<tbody>
 
    {{#each data.results.A.frames.[0].data.values.[0] as |car_name index|}}
    <tr>
       
        <td style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">{{car_name}}</td>

        
        <td style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">
            {{data.results.A.frames.[0].data.values.[1].[index]}}
        </td>

       
        <td style="padding: 15px; border: 1px solid #ddd; text-align: left; color: #000;">
            {{data.results.A.frames.[0].data.values.[2].[index]}}
        </td>
    </tr>
    {{/each}}
</tbody> 

(Table tag was also there i removed it as it was not showing up here)
And this is the query : select * from fastest_cars where manufacturer IN ($manufacturer)
(PostgreSQL)

I was not able to get any values with this : {{data.results.A.frames.[0].data.values.[1].[index]}}
so i tried hardcoding the data but if there are more than one values then the headings and the structure will get repeated.

please also post sample data from fastest_cars

@yosiasz
sorry for the late reply
Below is the query and the result
select * from fastest_cars where manufacturer like (‘BMW’);
id | car_name | top_speed | manufacturer
----±-------------------±----------±-------------
10 | BMW M5 Competition | 305.00 | BMW
11 | BMW M4 | 289.00 | BMW
(2 rows)

now that this has two values the table structure gets repeated for the two values
i have attached the image along with this.

1 Like

change the data selection to All Rows and not Every Row.

Also I just realized the dev lead for business text released a new plugin for tables called business table. I would try that out instead

@yosiasz Thanks for the reply and the suggestion.
I tried changing the render templates to all rows now the duplication issue is not there but the values are not being displayed properly can you please help with that.

Also in the business table panel is it possible to scroll the contents synchronously? (Horizontal and Vertical)
That is my end goal for trying the text panel if i can represent the values in form of table without the structure being duplicated i was thinking to make a custom scrollbar to do the synchronized scrolling.

I tried creating a custom plugin for that but one I change the scroll direction the contents of the table gets reset to their initial position and that beats the purpose of synchronized scrolling. Is there a way to do that in the table panel if so please help 🙂