cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

2 ACCEPTED SOLUTIONS

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

Re: How to automatically combine this complex conversion?

The JSL Quote() required for the Event Handler makes things more difficult.  I'm not sure there's another way than to Parse() it.

 

dt = New Table( "A", Add Rows( 1 ), New Column( "A", Character, "Nominal" ) );
xx = 1.3;
Eval(
	Parse(
		"\[:A << Add Column Properties(
	Set Property(
		"Event Handler",
		Event Handler(
			Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();
abc=]\"
		 || Char( xx ) || ";
  );)			)
		)
	)
);"
	)
);

mmarchandFSLR_0-1761147415193.png

 

View solution in original post

9 REPLIES 9
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
lala
Level IX

Re: How to automatically combine this complex conversion?

How can do it
Thanks Experts!

dt = New Table("A", Add Rows(1), New Column("A", Character, "Nominal"));
xx=1.3;
:A<<Add Column Properties(Set Property("Event Handler",Event Handler(Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();
abc=Expr(char(xx));
  );)))));

2025-10-22_23-08-42.png

lala
Level IX

Re: How to automatically combine this complex conversion?

I want get:

dt=Current Data Table();
abc=1.3;

Re: How to automatically combine this complex conversion?

The JSL Quote() required for the Event Handler makes things more difficult.  I'm not sure there's another way than to Parse() it.

 

dt = New Table( "A", Add Rows( 1 ), New Column( "A", Character, "Nominal" ) );
xx = 1.3;
Eval(
	Parse(
		"\[:A << Add Column Properties(
	Set Property(
		"Event Handler",
		Event Handler(
			Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();
abc=]\"
		 || Char( xx ) || ";
  );)			)
		)
	)
);"
	)
);

mmarchandFSLR_0-1761147415193.png

 

lala
Level IX

Re: How to automatically combine this complex conversion?

Thanks Experts!
However, the event response link in column B was not created successfully
Thanks!

dt = New Table( "A", Add Rows( 1 ), New Column( "A", Character, "Nominal" ), New Column( "B", Character, "Nominal" ), New Column( "C", Character, "Nominal" ), New Column( "D", Character, "Nominal" ) );
xx = 1.3;yy="two";
Eval(Parse("\[:A << Add Column Properties(Set Property("Event Handler",Event Handler(Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();
abc=]\"
|| Char( xx ) || 
"\[;    );)))));]\"));

Eval(Parse("\[:B<< Add Column Properties(Set Property("Event Handler",Event Handler(Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();dt[1,"A"]="one"
dt[1,"C"]=]\"|| yy || "\[;
dt[1,"D"]="th"
    );)))));
]\"));
jthi
Super User

Re: How to automatically combine this complex conversion?

It does give you error message

Unexpected "dt". Perhaps there is a missing "," or ")".
Trying to parse arguments of function "Function".
Line 3 Column 1: ►dt[1,"C"]=two;

Indicating that something is most likely wrong with the syntax. In this case it seems like you are missing ";" after "one"

-Jarmo
lala
Level IX

Re: How to automatically combine this complex conversion?

Thanks!

Eval(Parse("\[:B<< Add Column Properties(Set Property("Event Handler",Event Handler(Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, {},  
dt=Current Data Table();dt[1,"A"]="one";
dt[1,"C"]="]\"|| yy || "\[";
dt[1,"D"]="th"
    );)))));
]\"));

Recommended Articles