Forum Discussion

gyanianand's avatar
gyanianand
Cloud Apps
05-15-2023
Solved

Reorder columns in pivot table

Hi Team,@Angelina_QBeeQ

I want to order the weeks displayed in below pivot in desc order i.e latest week first and so on.

Also how to hide the "Header" word....i need the column but the column header should be blank.

Please help !!

 

  • Hi gyanianand ,
    If you want to reorder rows/columns, use the script below:

    widget.on('buildquery', function (se, ev) {
    	ev.query.metadata[3].jaql["sort"] = "desc"; // [3] add here the index of your query
    });

    The sample with result and query index here:

    To hide the column header, you can change the cell value:

    widget.transformPivot(
    	{},
      function (metadata, cell) {
        if (metadata.colIndex == 0 && metadata.rowIndex == 0) {
          cell.content = ' '
        }
      }
    );

    Always here to help,
    Angelina from QBeeQ
    [email protected]
    QBeeQ  - Gold Implementation and Development Partner

3 Replies

Replies have been turned off for this discussion
  • Hi gyanianand ,
    If you want to reorder rows/columns, use the script below:

    widget.on('buildquery', function (se, ev) {
    	ev.query.metadata[3].jaql["sort"] = "desc"; // [3] add here the index of your query
    });

    The sample with result and query index here:

    To hide the column header, you can change the cell value:

    widget.transformPivot(
    	{},
      function (metadata, cell) {
        if (metadata.colIndex == 0 && metadata.rowIndex == 0) {
          cell.content = ' '
        }
      }
    );

    Always here to help,
    Angelina from QBeeQ
    [email protected]
    QBeeQ  - Gold Implementation and Development Partner

  • Angelina_QBeeQ if this was a text field, how would you sort the columns by "Low", "Medium", "High"?

    Ascending or Descending won't work in this scenario, but I can't find references in the JAQL documentation.

    Any help would be greatly appreciated.