Transforming dattable

Transforming dattable

Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

Hi,
I am having an issue even trying to get the idea how this can be done using datatable. I am not sure if this is achievable using this amazing plugin. Please help me if you can or suggest another way of doing it

I have a table for Contract of a product called contracts .A contract can have up to 20 products in it and each product is linked to 20 different BUYERS, which means there are around 400 rows of data for each CONTRACT. At some point I will have to print this information (as required). I can print it but is is not reader friendly.
So, I want to transform this table in more reader friendly way.

For example, if you see in the picture, I have three products and each product is linked with 3 Buyers . Packing Quantity refers to different types of packings it comes with. In total there are 9 rows (practically I will have min 200 rows).
Can this be transformed into the table given below it?
which makes it easy to read and print.

Thank you.
Any help will be appreciated. Irrespective of the fact if it is achievable or not another donation is on the way :) This plugin has helped me a lot .

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923

    Datatables doesn't have a way of transforming the table. You will need to do it via a SQL query using something like GROUP BY and UNION ALL with multiple SELECT statements. Or transform it in your server code or Javascript before loading it into Datatables.

    Kevin

  • Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

    @kthorngren
    Thank you very much for the suggestions. I managed to do it using SQL query and put it in VIEW and then loaded it using Datatable.

    Again, thank you very much. Always appreciate your help :)

This discussion has been closed.