cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
joshua
Level III

Assigning data table to new name and keep the original data table untouched after processing

I'm trying to avoid making changes in my original data table and keep it un-intact when I do some operations

 

say we have this kind of scenario

 

<JSL>

for (i =  1, 3, i++, 

        dt_process = data table("dt_original);
        dt_process  << newcolumn("elclassico", character,formula(if (Contains(:club, "BARC") , "Barcelona", "delete")
       dt_process << save("save_my_club"||char(i))
)

After this process when i = 2 it the jsl says to me cannot find dt_original because the name has been changed. 
Why this is happening ?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Assigning data table to new name and keep the original data table untouched after processing

Save will change the name of the dataset and you are always using reference to same datatable (dt_original)

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
show(dt << get name);
dt << Save("$temp\deleteme Big Class.jmp"); // explicit location
show(dt << get name);

You could create subset instead and save that (if you don't need to leave these open, remember to close them)

dt_process = dt_original << Subset(Selected Columns(0), All Rows);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Assigning data table to new name and keep the original data table untouched after processing

Save will change the name of the dataset and you are always using reference to same datatable (dt_original)

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
show(dt << get name);
dt << Save("$temp\deleteme Big Class.jmp"); // explicit location
show(dt << get name);

You could create subset instead and save that (if you don't need to leave these open, remember to close them)

dt_process = dt_original << Subset(Selected Columns(0), All Rows);
-Jarmo
joshua
Level III

Re: Assigning data table to new name and keep the original data table untouched after processing

thank you very much!