Here is an example that works.
I assume that it will work for you, which means, if your code isn't working you need to look at your data to see what is wrong. You may want to look at the list of columns that you are getting from your dt_temp data table. Are the columns selected existing in the dt_main data table?
names default to here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");
dtSub = dt << subset(columns({PNP1,PNP2,PNP3}));
col_List = dtsub<<get column names(continuous);
gb = dt << Graph Builder(
Variables( X( :PNP4 ), Y( :NPN1 ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
Col_Switcher = gb << Column Switcher(
:PNP4,
col_List
);
Jim