0

Transposing a table to create new view

Hi,

I have the following setup:

I want to create something more in line with this:

 

Any suggestions on how I can potentially achive this? I was wondering if there's anyway to transpose tables in Ninox. I need this just as a view, so if there's a way to do it as a report - that's fine too.

Thank you

3 replies

null
    • Philipp
    • 3 yrs ago
    • Reported - view

    I would also need to do that.

    I have a database with companies and different attributes. 

    Company name | Turnover | Number of employees | Headquarters | CPC 

    Company A | 100 | 5 | Paris | EUR 80

    Company B | 200 | 19 | Düsseldorf | EUR 19

    Company C | 300 | 3 | Memphis | EUR 20

    Company D | 400 | 8 | Rio de Janeiro | EUR 10

    … 

    I would like to transpose this table in a view so that I can horizontally compare companies based on specific criteria. That is:

    Copany name | Company A | Company B | Company C ………

    Turnover

    Number of employees

    Headquarters

    CPC

    • Sean
    • 3 yrs ago
    • Reported - view

    I didn't spend a lot of time on this and it can be made prettier, but it is functional. The code would go in a Formula field...

     

    let compInfo := (select 'Company Info');
    let recCnt := count(compInfo);
    let htmlString := "
    <table style=""width:100%;"">
    <tr>" + for i in range(0, recCnt) do
    "<td>" + item(compInfo, i).Company + "</td>"
    end + "</tr>
    <tr>" + for i in range(0, recCnt) do
    " <td>" + item(compInfo, i).Employees + "</td>"
    end + "</tr>
    <tr>" + for i in range(0, recCnt) do
    " <td>" + item(compInfo, i).Turnover + "</td>"
    end + "</tr>
    <tr>" + for i in range(0, recCnt) do
    " <td>" + item(compInfo, i).Headquarters + "</td>"
    end + "</tr>
    <tr>" + for i in range(0, recCnt) do
    " <td>" + item(compInfo, i).CPC + "</td>"
    end + "</tr>
    </table>";
    html(htmlString)

    • Philipp
    • 3 yrs ago
    • Reported - view

    Thank you. I am gonna give this a try. 

Content aside

  • 3 yrs agoLast active
  • 3Replies
  • 525Views