I am trying to read Goal and Importance from one jmp table and set them into columns in a different table. I am not able to understand how I can loop around the column names to read data from the other limits table. Here is my script:
Names Default To Here( 1 );
// Select the data table and open it
path = Pick File( "Select Data Table" );
dt = Open( path );
// Select the limits table and open it
path = Pick File( "Select Limits Table" );
dt2 = Open( path );
Current Data Table( dt );
x = dt << Get Column Names(string,numeric);
y = dt2:ColumnName << Get Column Names();
show(x);
show(y);
ncols = N Items(x);
for (i=1, i<=ncols, i++,
a = Column(i) << Get Name;
show(a);
dt << current data table ();
Eval(
Eval Expr(
Column(dt,Expr(x)) << Set Property(
"Response Limits",
{Goal(Expr(Goal)), Lower(a,b), Middle(c,d), Upper(e,f)});
)
)
);
I would appreciate if anyone could explain to me the looping and matching part. Thanks
@powerpuff
Please don't stop asking questions! In fact ask more questions, if it will help you understand the scripts etc. that the community members have included in their replys to your questions. It is my hope that the Community can help you with your journey into JMP so that in the near future you can return the favors back by passing it forward to future new-to-JMP members.
@txnelson Thanks a lot for the help . I am sorry about posting questions frequently. JMP is really new to me. Thanks a lot for helping.
@powerpuff,
Your script that you listed in your initial description appeared to be a grouping of pieces of code that you have seen from other sources, rather than a script based upon processing through the problem.
The JMP Discussion Community is not a pool of code generators. That said, below is a working script of the problem you are working on.
Names Default To Here( 1 );
// Assign pointers to the data table, and limits table,
// using the sample tables you supplied
dt1 = Data Table( "example_limits" );
dt2 = Data Table( "res" );
// Loop through the table with the limits, and add them to the
// data table
For(i=1,i<=n rows(dt2),i++,
eval(
substitute(
expr(
__col__ << set property("Response Limits",
{Goal( __Goal__ ), Importance( __Imp__ ),
Lower( __LVal__, __LDes__ ),
Middle( __MVal__, __MDes__ ),
Upper( __UVal__, __UDes__ ),
Show Limits( 1 )
}
);
),
Expr( __col__ ), Parse( "dt1:" || dt2:ColumnName[i]),
Expr( __Goal__ ), Parse( dt2:Goal[i] ),
Expr( __Imp__ ), dt2:Importance[i],
Expr( __LVal__ ), dt2:Lower[i],
Expr( __LDes__ ), .,
Expr( __MVal__ ), dt2:Middle[i],
Expr( __MDes__ ), .,
Expr( __UVal__ ), dt2:Upper[i],
Expr( __UDes__ ), .,
)
)
);
Once again, I strongly encourage you to read the Scripting Guide.