cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
lala
Level IX

How to automatically combine this complex conversion?

In JSL, there is already a list variable abc. How can the values of this variable be written one by one into a new script without automatically re-entering the specific variable values

Thanks!

abc={"A","B","C","D","E"};
dt=New Table("A",Add Rows(1),New Column("A",Character,"Nominal"));
Eval(Parse("dt<<new script(\!"SS\!", abc; );"));
Eval(Parse("dt<<new script(\!"OK\!", abc={\!"A\!",\!"B\!",\!"C\!",\!"D\!",\!"E\!"};; );"));

2025-09-13_19-06-40.png

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to automatically combine this complex conversion?

Is this what you are looking for?

Names Default To Here(1);


abc = {"A", "B", "C", "D", "E"};

dt = New Table("A", Add Rows(1), New Column("A", Character, "Nominal"));

Eval(EvalExpr(
	dt << New Script("A", 
		Expr(abc)
	);	
));

jthi_0-1757767160429.png

Or do you wish to have a script which will set abc variable to the list of values within the table script?

-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: How to automatically combine this complex conversion?

Is this what you are looking for?

Names Default To Here(1);


abc = {"A", "B", "C", "D", "E"};

dt = New Table("A", Add Rows(1), New Column("A", Character, "Nominal"));

Eval(EvalExpr(
	dt << New Script("A", 
		Expr(abc)
	);	
));

jthi_0-1757767160429.png

Or do you wish to have a script which will set abc variable to the list of values within the table script?

-Jarmo
lala
Level IX

Re: How to automatically combine this complex conversion?

Thanks!

OK

Eval(EvalExpr(
	dt << New Script("A", 
		abc=Expr(abc)
	);	
));
jthi
Super User

Re: How to automatically combine this complex conversion?

You generally have three options

Names Default To Here(1);

dt = New Table("A", Add Rows(1), New Column("A", Character, "Nominal"));

// No variable
abc = {"A", "B", "C", "D", "E"};
Eval(EvalExpr(
	dt << New Script("A1",
		Expr(abc)
	);	
));


// Freely define the variable name within table script
abc = {"A", "B", "C", "D", "E"};
Eval(EvalExpr(
	dt << New Script("A2",
		abc = Expr(abc)
	);	
));


// Use expression to define variable and it's value within table script
// If you need abc defined outside of table script, you can use Eval(abc_expr);
abc_expr = Expr(abc = {"A", "B", "C", "D", "E"});
Eval(EvalExpr(
	dt << New Script("A3", 
		Expr(Name Expr(abc_expr))
	);	
));
-Jarmo

Recommended Articles