I figured the problem out via this post.
By using Column(listDT,set_groupby) in for char(set_groupby).
Row Legend(
//group by this
Column(listDT,set_groupby),
Color( 1 ),
Color Theme( "JMP default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}Hi,
(NOTE about the context: I am working on a graph template that automates making graphs for each label (A, B, C, D, and E) in the dataset (see the attached script) then to append it to the same output window for easy export and sharing. Here, I am using a single graph for label "A" as an example to prove what is wrong with my script. )
I have been having an issue with my JMP script not reading the selected Group-by variable from the user selection in the modal window. I want the user to select a "group by" column name from the data that could be any group-by variable and have a legend and coloring scheme as in the example below.

In the attached JMP data table, my toy data has the generic "group" column. But, a user should be able to select any character variable (such as mfg site, batch, process, formulation) from the table and have the group-by legend and coloring scheme.
Here is my JMP script:
//select the data in the original data table
Names Default To Here( 1 );
dt = Current Data Table();
/*
2/28/2022 Edit
get column names to
1. get x-axis variable
2. get grouping variable for coloring the dots
- needs to be a none option for when there is no group
- logic statement later if set_groupby is "none", then no
-
Also, ask user what coloring scheme should be used.
JMP auto color (blue and red) or none (if manually coloring by, for example, batch ID)
see source: https://www.jmp.com/support/help/zh-cn/15.2/index.shtml#page/jmp/get-column-names.shtml
*/
column_names = dt << Get Column Names( Numeric, character, String );
//TO DO:
//names_for_groupby_select =
//group by should be a character variable only, so
<FONT color="#FF0000">groupby_col_names = dt << Get Column names(character, String);</FONT>
nw1 = New Window("Set X-axis and group by variable",
<<MODAL>groupby_col = Radio Box(groupby_col_names),
H List Box(
Button Box("OK",
answers = Eval List({set_xlabel = xaxisselect << get selected,
<FONT color="#FF0000">set_groupby = groupby_col << get selected</FONT>
});
nw1 << close window;
),
Button Box("Cancel")),
//change popup window size
<<SIZE window=""> 9, 5);
// generic chart (can be control chart or process chart)
Oneway(
SendToByGroup( {:Name("Label (y-axis)") == label_val},
Y( :Result ),
X( char(set_xlabel) ), //:Name("x axis") ),
Connect Means( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch(
{},
"Result",
TextEditBox,
{Set Text( label_val || units_formatted )}
),
//font size:
Dispatch(
{},
"2",
ScaleBox,
{Label Row( Set Font Size( font_size ) )}
),
//graph stuff:
Dispatch(
{},
"Oneway Plot",
FrameBox,
{Frame Size( 1000, 300 ), DispatchSeg(
CustomStreamSeg( 6 ),
{Line Color( "Gray" )}
),
<FONT color="#FF0000">Row Legend(
//group by this
//:Name("Group"), //or just Group works too
char(set_groupby), // << need to be specified by user.
//set_groupby, // TO DO: fix this bug!</FONT>
Color( 1 ),
Color Theme( "JMP default" ), // TO DO: << needs to be specified by user.
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
);
);
container << Append(content)
);</SIZE></MODAL>
In this JMP script, the x-axis column selection works (see the modal window example and the resulting graph below), so I assumed that the group-by variable reference will also work as well. But the output produces a graph that does not have any group-by variable or legend. What is my code doing incorrectly here?
Modal Window:

JMP output example graph for label "A"

You can also use Eval()
Row Legend(
//group by this
Eval(set_groupby),
Color( 1 ),
Color Theme( "JMP default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}