- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Deleting Specific Column after closing Graph Builder
Hello,
Currently I have code that populates a data table with a new column containing a formula. This column is then used as overlay in graph builder.
I was wondering if there is a way to delete this column (with the formula) once the user exits out of the graph builder. Thank you for the help!
Names Default To Here (1);
dt = Current Data Table();
// first program
program1 = function({},
show("formula 1");
// JSL code
dt << New Column("Bin", Character, formula(If( /*formula code*/)));
);
// second program
program2 = function({},
show("formula 2");
// JSL code
dt << New Column("Bin", Character, formula(If( /*formula code*/)));
);
// third program
program3 = function({},
show("formula 3");
// JSL code
dt << New Column("Bin", Character, formula(If( /*formula code*/)));
);
// fourth program
program4 = function({},
show("formula 4");
// JSL code
dt << New Column("Bin", Character, formula(If( /*formula code*/)));
);
//window that allows users to press button to generate graph with state ID labels based on protocol type
nw = new window("Program Options", << modal,
panel box("Click the button to run the desired program",
lineup box(ncol(1),
SpacerBox(),
b1 = button box("program 1",
program1();
okBtn << Click();
),
b2 = button box("program 2",
program2();
okBtn << Click();
),
b3 = button box("program 3",
program3();
okBtn << Click();
),
b4 = button box("program 4",
program4();
okBtn << Click();
),
),
),
h list box(SpacerBox(),okbtn = Button Box("Cancel"), SpacerBox())
);
//make graph
gb = dt << Graph Builder (
//time, volume, bin are column names
Variables( X( :Time ), Y( :Volume ), Overlay( :Bin )),
Elements
(
Points
(
X, Y, Legend( 9 )
)
),
Categorical Color Theme("JMP Vibrant");
);
reportWindow = gb << Report;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
You need to use the On Close() function
Here is an example
names default to here(1);
dt=open("$sample_data/big class.jmp");
dt<<new column("x", formula(:height/:weight));
gb = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :x ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
gb << on close(dt<<delete columns("x"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
You can add <<On Close() to the graph builder window which will delete the column. Example with Big Class, will delete sex column when graph builder is closed
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(535, 451),
Show Control Panel(0),
Variables(X(:age), Y(:weight), Overlay(:sex)),
Elements(Points(X, Y, Legend(13)))
);
gb << On Close(dt << Delete Column("sex"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
You need to use the On Close() function
Here is an example
names default to here(1);
dt=open("$sample_data/big class.jmp");
dt<<new column("x", formula(:height/:weight));
gb = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :x ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
gb << on close(dt<<delete columns("x"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
Thank you! Exactly what I needed!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
You can add <<On Close() to the graph builder window which will delete the column. Example with Big Class, will delete sex column when graph builder is closed
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(535, 451),
Show Control Panel(0),
Variables(X(:age), Y(:weight), Overlay(:sex)),
Elements(Points(X, Y, Legend(13)))
);
gb << On Close(dt << Delete Column("sex"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Deleting Specific Column after closing Graph Builder
Thanks! This is perfect!