Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I’m trying to sort my data with a hypercube. The final aim is to have a table ordered by value like this (example) :
Variable 1 (Dimension) | Variable 2 (Measure 1) | Variable 3 (Measure 2) | Variable 4 (Measure 3) |
Name 1 | 50 | 1 | 100 |
Name 2 | 90 | 2 | 150 |
Name 3 | 20 | 3 | 3 |
I’m able to sort the table based on Variable1 (dimension) or on Variable2 (first measure into the hypercube) thanks to “qInterColumnSortOrder” :
- If it equal to [0,1], values are sorted based on dimensions (therefore, based on Variable 1).
- If it equal to [1,0], values are sorted based on measures (therefore, based on Measure 1).
How can I do if I want to sort my data based on the second measure and not based on the first measure?
Thanks in advance for your answers
To obtain this, my hypercube is constructed like this :
app.createCube({
qDimensions : [
{qDef : {
"qFieldDefs": Variable1},
qOtherTotalSpec : {
"qOtherSortMode": "OTHER_SORT_ASCENDING"}
}
],
qMeasures : [
{qDef : {
qDef : Variable2 Equation},
qLabel : "sel_0",
qSortBy : {"qSortByNumeric": -1}},
{qDef : {
qDef : Variable3 Equation},
qLabel : "sel_1",
qSortBy : {"qSortByNumeric": -1}},
{qDef : {
qDef : Variable4 Equation},
qLabel : "sel_2",
qSortBy : {"qSortByNumeric": -1}}
],
qInterColumnSortOrder : [0,1],
qInitialDataFetch : [{
qHeight : q_height,
qWidth : q_width}]
}, function(reply) { /*-- Construction of table --*/ }
Hi, I know this may be late, but i believe that the qInterColumnSortOrder array is the order in which the columns are sorted. Therefore I would suggest that you try [2], or something like [2,1,3,0] etc. Thanks David
I could sort it by adding a SortExpression directly to the dimension definition itself
{
qDimensions : [{
qDef : {
qFieldDefs : ["Product Name"],
qSortCriterias: [
{
qSortByExpression: -1,
qExpression: {qv: "Sum(Sales)" }
}
]
}
}],
qMeasures : [{
qDef : { qDef : "Sum(Sales)" }
},{
qDef : { qDef : "Column(1)*2" }
}],
//qInterColumnSortOrder : [0,1,2],
qInitialDataFetch : [{
qTop : 0,
qLeft : 0,
qHeight : 100,
qWidth : 4
}]
};