- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Insert contents of Parse expression rather than variable name into New Script
I am looking to extend @Craige_Hales excellent answer from Insert contents of variable/expression rather than variable name into New Script by combining script, but have not worked out the syntax. Any ideas to get this to work?
I am using JMP 18.1.2
Names Default To Here( 1 );
dt = New Table( "My Table" );
e1 = Expr(
Print( "Run some code." )
);
e2 = Expr(
Print( "Run some other code." )
);
e3 = Expr(
Parse( Eval Insert( "\[
^e1^;
^e2^;
]\" ) )
);
// These work.
Eval( Eval Expr( dt << New Script( "Test 1", Expr( Name Expr( e1 ) ) ) ) );
Eval( Eval Expr( dt << New Script( "Test 2", Expr( Name Expr( e2 ) ) ) ) );
// This does not work.
Eval( Eval Expr( dt << New Script( "Test 3", Expr( Name Expr( e3 ) ) ) ) );
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert contents of Parse expression rather than variable name into New Script
Created:
Mar 21, 2025 02:37 PM
| Last Modified: Mar 21, 2025 11:38 AM
(160 views)
| Posted in reply to message from robot 03-21-2025
Print your e3 to see what it contains
Name Expr(e3) = Parse(Eval Insert("
^e1^;
^e2^;
"));
This possibly does what you are looking for
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = Parse(Eval Insert("\[
^Name Expr(e1)^;
^Name Expr(e2)^;
]\"));
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));
I would generally avoid using Parse as it is a nightmare to debug
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = EvalExpr(
Expr(Name Expr(e1));
Expr(Name Expr(e2));
);
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));
-Jarmo
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert contents of Parse expression rather than variable name into New Script
Created:
Mar 21, 2025 02:37 PM
| Last Modified: Mar 21, 2025 11:38 AM
(161 views)
| Posted in reply to message from robot 03-21-2025
Print your e3 to see what it contains
Name Expr(e3) = Parse(Eval Insert("
^e1^;
^e2^;
"));
This possibly does what you are looking for
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = Parse(Eval Insert("\[
^Name Expr(e1)^;
^Name Expr(e2)^;
]\"));
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));
I would generally avoid using Parse as it is a nightmare to debug
Names Default To Here(1);
dt = New Table("My Table");
e1 = Expr(Print("Run some code."));
e2 = Expr(
Print("Run some other code.")
);
e3 = EvalExpr(
Expr(Name Expr(e1));
Expr(Name Expr(e2));
);
Eval(Eval Expr(dt << New Script("Test 3", Expr(Name Expr(e3)))));
-Jarmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Insert contents of Parse expression rather than variable name into New Script
Excellent!