on ‎2023 Mar 15 3:26 AM
Request clarification before answering.
My understanding is that we want to add dimension member values to the checkboxGroup,
When added to the checkbox the values need to be sorted by the Rank column value.
Using the BestRunJuice sample data
We have a table with a dimension: Store & measure: Gross Margin
In your example Gross Margin would be the Rank column

When the button is clicked the store values will be added to the CheckBoxGroup,
They will be added in the order low > high based on the Gross Margin column.
The code in the button is:
CheckboxGroup_1.removeAllItems();
var dims = Table_1.getDimensionsOnRows()[0];
// sort the table low - high by the measures
var sel=Table_1.getDataSource().getDataSelections()[0];
Table_1.sortByValue(sel,SortOrder.Ascending,Direction.Vertical);
// the rest of the code grabs the values from the table and adds them to the checkbox
var selections=Table_1.getDataSource().getDataSelections();
var memberID = ArrayUtils.create(Type.string);
var memberDESC = ArrayUtils.create(Type.string);
for (var i = 0; i < selections.length; i++) {var member = Table_1.getDataSource().getResultMember(dims, selections[i]);
{ memberID.push(member.id);
memberDESC.push(member.description);}}
for (var q=0;q<memberDESC.length;q++)
{CheckboxGroup_1.addItem(memberID[q],memberDESC[q]);}
//remove the sort on the table
Table_1.removeSorting();
The table is sorted by Gross margin, the Store values are added to the Checkbox

At the end of the script we reset the table sort back to default

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

Sir jbarlowjb on your sample code the checkbox list are sorted or arrange base on the gross of each item. Its works correctly. But I have a question. Is it also possible to arrange the checkbox list based also on the rank but it is cascaded from the specific type. Example: There are different type of juice. There is column on the table with sweet, sour, bitter taste of juice then another column for the specific juices under that kind of taste then another column for the rank of those juices. I'm looking for the way to sort the list of specific juices under for example the sweet taste of juice. Please see the sample image of table labeled by process.
Hi Sir jbarlowjb the thing is it is not filtered on table just logically filtered on checkbox and then arrange it before displaying. Just need to cascade the table logically then display the information sorted in the checkbox. So far, some reference I got do it in two for loop but I dont get how to simulate it properly. Any idea Sir ?
If you want to arrange the checkbox values according to the other dimension member, then one thing you can do. You can make the "Rank_Countries" the ID and "City Branch" as the description. And then you can just use a for loop to add the "City Branch" values to the Check Box which will be sorted according to the ID.

Please upvote, if this answer helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CheckboxGroup_1.removeAllItems();
res = Tbl_Retail_1.getDataSource().getResultSet({"Hemisphere_Globe":Checkbox_HemisphereList_arry});
console.log(res);
for (a=0; a<res.length; a++){
CheckboxGroup_1.addItem(res[a]["Rank_Branch"].id,res[a]["City_Branch"].description);
num
}
Note: After doing this one I still cant arrange the order of the displayed branch on the checkbox.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 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.