Transpose columns into in a table

  • 1
  • Question
  • Updated 9 months ago
  • Answered
I have a requirement where there will be only  two records in a table but that has almost 12 columns to display, is there way where I can display the columns as rows and rows as columns in a table.

Thanks,
Premanuj
Photo of Premanuj Gupta

Premanuj Gupta

  • 100 Points 100 badge 2x thumb

Posted 9 months ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
There are two options. 
1. We have seen customers build custom views using our Javascript API that transpose columns and rows.  
https://docs.skuid.com/latest/en/skuid/javascript/snippets/table-custom-views.html

2.  You can create a quasi table using a field editor.  Make it have 3 columns and add templates to each column for every cell of your table. 
- Column 1 is your titles.  
- Column 2 and 3 are your data rows.   The template should use global model merge syntax to pull in the right value.  

In column 2 syntax would look like:  {{$Model.ModelName.data.0.FieldName}} .  (to get the field value for the first row of the model)
In column 3 syntax would look like {{$Model.ModelName.data.1.FieldName}} .  (to get the second row...) 

This is pretty brittle.  It won't ever show a third row of data.  But if your requirements are to only ever show 2 rows of data.  This might be a solution.