Hey @HarriBradbeer
Here is a script that will combine either columns you select in the Column list box for graph builder or you select on the actual data table as well. You can put the "Combined Filter" column it creates into Group X to have the group values from the columns as levels for the Group X axis. If you select new columns and rerun the script it will update the "Combined Filter" column values.
I actually added this as a button to my toolbar to make it more streamlined.
Hope this helps!
Steve
Names Default To Here( 1 );
dt=Current Data Table();
wait(0);
curWindow = current window() << Get Window Title; //get window title to curWindow variable
//use Try to check if curWindow is datatable with << Get name or N Rows
Try(
//Show(N Rows(Datatable(curWindow))),
Datatable(curWindow) << Get Name;
test=0, //datatable
test=1; //not datatable
);
if( test==1,
dt << begin Data Update;
obj=Current Report()["Graph Builder"]<< get scriptable object;
cnames = (obj<< XPath("//OutlineBox[text()='Graph Builder']//ListBoxBox")) << get selected;
cnames=cnames[1];
dt << Select Columns( eval(cnames) );
selcols=dt << Get selected Columns();
/* Obtain a list of all numeric column names as strings. */
numCols = dt << Get Column Names();
ct=0;
/* Loop through each numeric column. */
For( i = 1, i <=N Items( numCols ) , i++,
col name = Column( i ) << Get Name;
if( col name=="Combined Filter",
ct=1;
cti=i;
break();
)
);
dt << Combine Columns(
delimiter( "," ),
Columns( eval(selcols) ),
Multiple Response( 0 ),
Column Name( "Combined" )
);
dt << Clear Column Selection();
column(dt,"Combined")<< Set Selected( 1 );
dt << Move Selected Columns( To last );
if(ct==0,
dt<<New Column( "Combined Filter", Character, "Nominal" );
column(dt,"Combined Filter")<< Set Selected( 1 );
dt << Move Selected Columns( To first );
);
dt << Move Selected Columns( To first );
for each row(dt,:Combined filter=:Combined );
try(dt << Delete Columns(Column( "Combined" ) ));
wait(0.1);
dt << Go to( eval(selcols) );
dt << End Data Update;
);
if(test==0,
dt<<begin data update;
selcols=dt << Get selected Columns();
/* Obtain a list of all numeric column names as strings. */
numCols = dt << Get Column Names();
ct=0;
/* Loop through each numeric column. */
For( i = 1, i <=N Items( numCols ) , i++,
col name = Column( i ) << Get Name;
if( col name=="Combined Filter",
ct=1;
cti=i;
break();
)
);
dt << Combine Columns(
delimiter( "," ),
Columns( eval(selcols) ),
Multiple Response( 0 ),
Column Name( "Combined" )
);
dt << Clear Column Selection();
column(dt,"Combined")<< Set Selected( 1 );
dt << Move Selected Columns( To last );
if(ct==0,
dt<<New Column( "Combined Filter", Character, "Nominal" );
column(dt,"Combined Filter")<< Set Selected( 1 );
dt << Move Selected Columns( To first );
);
for each row(dt,:Combined filter=:Combined );
try(dt << Delete Columns(Column( "Combined" ) ));
wait(0.1);
dt << Go to( eval(selcols) );
dt << End Data Update;
);