on 2025 Jan 29 1:43 PM
Hi Gurus,
I have a Requirement, Where user wants to get the list of Orders whose value is greater than 1 Million, 500k-1Million, 100K-500K and <100K using a Radio button. Below is the sample table data. I have introduced a Radio button as below.
What I'm not sure is that how could I achieve this using Java Script in SAC.
Regards,
Ram
Request clarification before answering.
This is a copy/paste for a post I wrote ages ago - so apologies if the context is not spot on,
but it will meet your requirement:
It includes additional code to set button colours etc - so you could ignore that part.
This approach can be used if you need to filter using buttons or radio buttons, you could of course just use the native input controls.
// this is just used to change the button css class
ACTIVE.setCssClass('boff');
ACTIVE=this;
ACTIVE.setCssClass('bon');
// end button css class: Script Var ACTIVE is defined as type button
Table_2.getDataSource().removeDimensionFilter("Region");
var arr = Table_2.getDataSource().getResultSet();
var dimension_members = ArrayUtils.create(Type.string);
// push dimension member to array if measure value meets the condtion, e.g. >10000000
// You obviously need to adjust the code for each button / radio button value ---
for (var i=0;i<arr.length;i++)
{ var string = arr[i][Alias.MeasureDimension].rawValue;
var number = ConvertUtils.stringToNumber(string);
if(number>10000000) {dimension_members.push(arr[i]["Region"].id); } }
// filter the table with the dimension ids present in the array
Table_2.getDataSource().setDimensionFilter("Region",dimension_members);
// just used to set the Radio button key to match the button clicked
RBG.setSelectedKey('> 10 Mil');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ramsthota1986,
You can consider this option as well,
You can achieve this by measure input control
1. Select Measure input and add range here I am added sale and order dimension for set up
2. You can filter as per your range Here I set 0-100
Range 100-500
Kindly upvote if you find it useful.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to create Measure/Account base dimension
then use dimension as filter
Let me know if you need further information.
Regards
Bilal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bilal,
Thank you for your response, My backend models are based on Live connection and I don't see an option to create account based dimension. Could you please care to explain more on how to create this.
My SAC details are as below.
Regards,
Rambabu
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 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.