cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. ET on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
AsymptoticCos
Level II

Lock a column in script while working with multiple tables with same column names

I have three tables I am working with in my JSL. I am calling these dt1, dt2, dt3. 

 

dt1 has the columns A, B, C, D

dt2 has the columns B, X, Y, Z

dt3 has the columns D, Q, R, S

 

I want to lock B in table dt2. How do I do that? The usual ":B << lock (1)" script is locking B in dt1. 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Lock a column in script while working with multiple tables with same column names

If you don't tell JMP which table to use, it uses current data table -> use more robust method of referencing to your column (add datatable reference). Column(dtref, colname) is my preferred method

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Column(dt, "Age") << Lock(1);

You could also use dt:Age

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt:Age << Lock(1);

 

Edit:

From Scripting Guide check out Scripting Guide > JSL Building Blocks > Rules for Name Resolution > Scoping Operators

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Lock a column in script while working with multiple tables with same column names

If you don't tell JMP which table to use, it uses current data table -> use more robust method of referencing to your column (add datatable reference). Column(dtref, colname) is my preferred method

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Column(dt, "Age") << Lock(1);

You could also use dt:Age

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt:Age << Lock(1);

 

Edit:

From Scripting Guide check out Scripting Guide > JSL Building Blocks > Rules for Name Resolution > Scoping Operators

-Jarmo

Recommended Articles