Trying to have pivot table output with sorted rows and columns
I've tried different combinations of sortrowkey
, col
keys etc and can't find the right syntax. Latest try was making sure the data doing into the cube before the pivot was sorted and using the preservegrouporder
.
var pvtTbl = new PivotTable(
new[] { "YearQuarterMonth" },
new[] { "StageName" },
slicedCube);
_ = pvtTbl.PreserveGroupOrder == true;
pvtTbl.SortRowKeysByColumnKey(null, 1, ListSortDirection.Ascending);
_ = pvtTbl.PreserveGroupOrder == true;
pvtTbl.SortColumnKeysByRowKey(null, 1, ListSortDirection.Ascending);
//pvtTbl.SortRowKeys(null, 1, ListSortDirection.Ascending);
//pvtTbl.SortColumnKeys(null, 1, ListSortDirection.Ascending);
var strJsonWr = new StringWriter();
var jsonWr = new PivotTableJsonWriter(strJsonWr);
So far it seems to only apply 1
or none of the sorts, never both.