cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get the contracts list whose value is greater than 1 million & between 500k to 1 Mil Using Radio But

ramsthota1986
Explorer
0 Kudos
482

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.

ramsthota1986_1-1738158063208.png

ramsthota1986_0-1738157980301.png

What I'm not sure is that how could I achieve this using Java Script in SAC.

Regards,

Ram

 

Accepted Solutions (1)

Accepted Solutions (1)

JBARLOW
Active Contributor
0 Kudos

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.

Filtering measure values – conditional e.g. greater or less than


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.

JBARLOW_0-1738323197609.png

// 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');

ramsthota1986
Explorer
0 Kudos
Hi Jbarlow,

Answers (2)

Answers (2)

Yogeshwar_M
Active Participant
0 Kudos

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

Yogeshwar_M_0-1738402879867.png

2. You can filter as per your range Here I set 0-100

Yogeshwar_M_1-1738402970642.png

Range 100-500

Yogeshwar_M_2-1738403079908.png

Kindly upvote if you find it useful.

Thanks

 

chmbilal
Participant
0 Kudos

Hi @ramsthota1986 

You need to create Measure/Account base dimension 

chmbilal_0-1738215519280.png

then use dimension as filter

Let me know if you need further information.

Regards

Bilal 

 

ramsthota1986
Explorer
0 Kudos

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.

Versions
2024.21.15 (Client)
2024.21.14 (Server)
Commits
f9d1d5403a0c37205f1de578d197f1d6c1dc78da (Client)
5bfef6daf9c0af39e1e128ee1a4ecb4590b406a7 (Server)
Build Dates
Wed Jan 22 2025 18:23:57+0000 (Client)
Wed Jan 15 2025 18:43:29+0100 (Server)

Regards,

Rambabu