Subscribe Bookmark RSS Feed

Deleting table variables

asdfasdf

Community Trekker

Joined:

Aug 1, 2012

I'm trying to delete table properties in a loop but nothing happens. There's no error message in the log window, so I'm not sure why i can't delete table variables in a loop.

If I use a literal string I'm able to delete the variable, but I would like to delete a list of variables by pattern matching.


dt = New Table("test");



dt << New Table Variable("a", 1);


dt << New Table Variable("b", 1);


dt << New Table Variable("c", 1);



names = dt << Get Table Variable Names;



for(i = N Items(names), i > 0, i--,


    variable = names;


    // Fails


    dt << Delete Table Variable(variable);


);



// Ok


dt << Delete Table Variable("a")


1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Your example works here, JMP 10.0.2 for Mac. But it may not be working in JMP 9. Are you using a version <10?

Try this in JMP 9:

dt = New Table( "test" );

dt << New Table Variable( "a", 1 );

dt << New Table Variable( "b", 1 );

dt << New Table Variable( "c", 1 );

names = dt << Get Table Variable Names;

For( i = N Items( names ), i > 0, i--,

  variable = names[i];

  Eval( Parse( Eval Insert( "dt << Delete Table Variable(^nameexpr(variable)^)" ) ) )

);

2 REPLIES
Solution

Your example works here, JMP 10.0.2 for Mac. But it may not be working in JMP 9. Are you using a version <10?

Try this in JMP 9:

dt = New Table( "test" );

dt << New Table Variable( "a", 1 );

dt << New Table Variable( "b", 1 );

dt << New Table Variable( "c", 1 );

names = dt << Get Table Variable Names;

For( i = N Items( names ), i > 0, i--,

  variable = names[i];

  Eval( Parse( Eval Insert( "dt << Delete Table Variable(^nameexpr(variable)^)" ) ) )

);

asdfasdf

Community Trekker

Joined:

Aug 1, 2012

I'm using JMP 9. Your solutions works. Thanks