Hi JMP Community,
I'm trying to set up a window where users can select different months, or quarters, or the entire YTD, that also provides feedback of which button boxes have been selected (or even deselected). My intent is to ultimately use the month/quarter/YTD selection as a way to create a subset of a data table based on the month (year is always set to current year for now).
Here's a window of what I'm thinking about:
Whenever a month is selected, the code will define a variable as "01" for Jan, "05" for May, or "1" for Q1, etc. What I'd like is for the button to look like it's either "clicked" by appearing pressed, or better turn a highlighted color, like blue. Something similar to what happens in the Data Filter platform, like when using Big Class and adding a local Data Filter by :name, where the name is highlighted and more than one selection can be made at a time. Along with showing that the button has been selected, I would like it to show if the button has been deselected -- much like a check box showing it's marked or not -- but I don't want to use check boxes as it's less visually appealing.
The code for the window I created looks like (see below), and of course, when the user clicks on "OK", the code will then create the subset data table and then also close the selection window. In setting the variable for the month selected "mo#", is there a less cumbersome way to assign it the 01Jan2024 value than the code AsDate(Date DMY(dd,mm,yyyy))? it works just fine, it's just a bit cumbersome.
Names Default To Here( 1 );
yr = Year( Today() );
subwin = New Window( "Select Subset",
<<Type( "Dialog" ), <<Size(360,200),
Panel Box( "Select Month(s) in Current Year for Subset",
LB = Lineup Box( N Col( 5 ),
Button Box( "Jan", mo1 = AsDate(Date DMY(01,01,eval(yr))) ),
Button Box( "Feb", mo2 = AsDate(Date DMY(01,02,eval(yr)))),
Button Box( "March", mo3 = AsDate(Date DMY(01,03,eval(yr))) ),
Spacer Box(),
Button Box( "Q1", q = 1 ),
Button Box( "April", mo4 = AsDate(Date DMY(01,04,eval(yr))) ),
Button Box( "May", mo5 = AsDate(Date DMY(01,05,eval(yr))) ),
Button Box( "June", mo6 = AsDate(Date DMY(01,06,eval(yr))) ),
Spacer Box(),
Button Box( "Q2", q = 2 ),
Button Box( "July", mo7 = AsDate(Date DMY(01,07,eval(yr))) ),
Button Box( "Aug", mo8 = AsDate(Date DMY(01,08,eval(yr))) ),
Button Box( "Sep", mo9 = AsDate(Date DMY(01,09,eval(yr))) ),
Spacer Box(),
Button Box( "Q3", q = 3 ),
Button Box( "Oct", m10 = AsDate(Date DMY(01,10,eval(yr))) ),
Button Box( "Nov", m11 = AsDate(Date DMY(01,11,eval(yr))) ),
Button Box( "Dec", m12 = AsDate(Date DMY(01,12,eval(yr))) ),
Spacer Box(),
Button Box( "Q4", q = 4 ),
Button Box( "YTD", y = 12 ),
Spacer Box(),
Spacer Box(),
Spacer Box(),
Spacer Box(),
Spacer Box(),
Spacer Box(),
Spacer Box(),
Button Box("OK"),
Button Box("Cancel/Exit", subwin << Close Window)
)
)
);
Any help is much appreciated!
Thanks!,
DS