2025 Mar 13 6:13 PM - edited 2025 Mar 23 6:46 AM
I have 6 measure and 1 dimension[staff] in this i want to get top 1 of each measure in single widget. Please explain me how can we done in sac
Regards,
Thayu.
Request clarification before answering.
So without a planning model, yep we're left with using text boxes to give the visual impression of a table.
In this example I only used 3 measures just to see if it works.
This should give you better performance and I'm sure my code/logic can be greatly improved to run more efficiently.
The 'table' on the right is 9 text boxes.
T1,T2,T3 -- T2 is the product, T3 is the value
T4,T5,T6 -- T5 is the product, T6 is the value
T7,T8,T9 -- T8 is the product, T9 is the value
T1,T4,T7 -- I just hardcoded the text in as the values never change
Table_3.rankBy( { relatedDimensions:{[Alias.MeasureDimension]:"M1"},rankOrder:RankOrder.Top,value:1});
var sel = Table_3.getSelections()[0];
var result = Table_3.getDataSource().getResultMember("Product",sel).description;
T2.applyText("Product"+" "+result);
var arr = Table_3.getDataSource().getResultSet();
var value= ConvertUtils.stringToNumber( arr[0][Alias.MeasureDimension].rawValue);
var V2=ConvertUtils.numberToString(value);
{T3.applyText(V2);}
//----------------------------------------------------------------------------
if(T3.getPlainText().length>0)
{
Table_3.rankBy( { relatedDimensions:{[Alias.MeasureDimension]:"M2"},rankOrder:RankOrder.Top,value:1});
sel = Table_3.getSelections()[0];
result = Table_3.getDataSource().getResultMember("Product",sel).description;
T5.applyText("Product"+" "+result);
arr = Table_3.getDataSource().getResultSet();
value= ConvertUtils.stringToNumber( arr[1][Alias.MeasureDimension].rawValue);
V2=ConvertUtils.numberToString(value);
T6.applyText(V2);
}
if(T6.getPlainText().length>0)
{
Table_3.rankBy( { relatedDimensions:{[Alias.MeasureDimension]:"M3"},rankOrder:RankOrder.Top,value:1});
sel = Table_3.getSelections()[0];
result = Table_3.getDataSource().getResultMember("Product",sel).description;
T8.applyText("Product"+" "+result);
arr = Table_3.getDataSource().getResultSet();
value= ConvertUtils.stringToNumber( arr[2][Alias.MeasureDimension].rawValue);
V2=ConvertUtils.numberToString(value);
T9.applyText(V2);
}
Table_3.removeRanking();You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @JBARLOW Thank you so much for the solution. Yes its improved the performance but now its taking around 29 sec because i am using 14 text boxes upto 10 text boxes performance was fine. Thank you so much it's a nice thought. please let me know is there anyway to bring under 20 sec.
Can you provide more detail - or an example of the data and desired result?
e.g. We data in the table on the left and we want to see the table on the right?
i.e. the Top sales volume for each store regardless of product etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @JBARLOW, Thanks for reply Please find the sample
Like this I want to do in sac live connection
In the left side table we have sales volume and sales quantity from that I want to get top 1 product of sales volume and top 1 product of sales quantity.
Regards,
Thayu.
Hi @JBARLOW Finally find a solution in with some scripting but its taking around 40 sec to l
In Table 1 :
Created a aggregation Calculation with the operation max for the measure which I want to get top 1.
In Table 2 :
I added the aggregation calculation on column and dimension staff on rows
Sac Scripting to find top 1 dimension for different measure in OnInitialization is working but its taking around 30 sec to load
Output:
Please let me know in there any way to Improve the performance
Regards,
Thayu.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.