- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
talk to enhanced log
The enhanced log knows which command is sent to which data table and indicates the source and output data tables and reports with different colors. The icons can be used to bring the respective window to the front:
Is there a JSL functionality that allows me to talk to the enhanced log?
like
log << list commands(10);
to get the last 10 commands.
or log << list commands("3h");
for the commands of the last 3 hours?
or
log << list commands(data table(dt));
to get all commands which were triggered with target data table dt.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: talk to enhanced log
Enhanced Log is inside window called Log (if you are using enhanced log), from there you can use show properties and figure out that there is table box which contains a lot of different things
Names Default To Here(1);
elog = Window("Log")[Table Box(1)] << get;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: talk to enhanced log
Enhanced Log is inside window called Log (if you are using enhanced log), from there you can use show properties and figure out that there is table box which contains a lot of different things
Names Default To Here(1);
elog = Window("Log")[Table Box(1)] << get;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: talk to enhanced log
cool!
done
- collect table creation script, editing scripts and report creation script from enhanced log
- get the original data table via the enhanced log to save the final script
- replace original table name with variable mydt to counteract table name collisions
[-> my suggestion for Workflow Builder] - remove duplicate/template messages
- multiple data tables with the same name? assume that the last one is the right
- reports with/without data filter
- StealThisCode can be used iteratively to optimize the report and save it again
[similar to: save script to data table - run - edit - save script to data table ....]
todo:
- debugging
then I will upload the new version ...
Graph Builder Toolbar
this is how it could look like:
- Chapters
- descriptions off, selected
- captions settings, opens captions settings dialog
- captions off, selected
- en (Main), selected
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
This is a modal window. This modal can be closed by pressing the Escape key or activating the close button.
current version:
// autor: Holger Specht (hogi)
// extension of https://community.jmp.com/t5/Discovery-Summit-Americas-2021/Steal-This-Code-Three-Upgrades-for-Scripts-Obtained-from-the/ta-p/398700
// the idea:
// - starting from a report
// - use the enhanced log to collect all processing steps which lead from a saved ("original") data table to the report
// - postprocess the steps to get a robus script
// - save the script to the origial data table
Names Default To Here( 1 );
show info = Function( {},
Caption( "please create a graph from a summary/subset table and run this script again. Add as many intermediate steps as you want :)" );
Stop();
);
Try(
If( Current Report()[Outline Box( 1 )] << Get Title() == "Local Data Filter",
myScriptableObject = (Current Report()[Outline Box( 2 )] << Get Scriptable Object()),
myScriptableObject = (Current Report()[Outline Box( 1 )] << Get Scriptable Object())
),
showInfo()
);
mydt = myScriptableObject << Get Data Table();
myWindowName = (mydt << Get Window()) << get window title();
//developer is here =1;
elog = Window( "Log" )[Table Box( 1 )] << make into data table(private( 1 ) );
rowCreated = Eval( Eval Expr( Where( elog, :Result == "Data Table( \!"" || Expr( myWindowName ) || "\!" )" ) ) );
nr = N Items( rowCreated );
If( nr == 0 & N Items( Current Report() << XPath( "//PanelBox[text()='//steal this code']" ) ) == 0,
show info()
);
// if the current report is already created via stealThisCode, get the saved infos
If( N Items( Current Report() << XPath( "//PanelBox[text()='//steal this code']" ) ),
dtOrig = (Eval( Parse( Current Report()[Text Box( 1 )] << get text )) );
myScript = Parse( Current Report() [Text Box( 2 )] << get text);
// if a data table was created with the same name, we have to get rid of the wrong log entries -> search for steal this code!
rowcreated = Where( elog, :Message == "\!"steal this code\!"" );
nr = N Items( rowCreated );
rowcreated = rowcreated[{nr}]
, // otherwise: get the original data table from the log and start with a draft data table
// the user created multiple data table with the same name? the last one might be the correct one ?!?!
rowcreated = rowcreated[{nr}];
// select the right actions
Window( "Log" )[Table Box( 1 )] << Set Selected Rows( rowCreated );
// get script from the log and remove the comment block
myScript = Parse( Substitute( Window( "Log" )[Script Box( 1 )] << get text, "/*:", "" ) );
dtOrig = Arg( myScript, 1 );
myScript = Substitute(
Expr(
Names Default To Here( 1 );
//marks the start of the execution in the log
Print("steal this code");
mydt = _x_;
),
Expr( _x_ ), Name Expr( myScript )
);
);
Eval( Eval Expr( myRows = elog << get rows where( :Origin == "Window( \!"" || Expr( myWindowName ) || "\!" )" & Row() > Expr( rowCreated ) ) ) );
if (N Items(myRows),
Window( "Log" )[Table Box( 1 )] << Set Selected Rows( myRows );
mydtch = Substitute( Char( mydt ), "DataTable(", "Data Table( ", ")", " )" );
myscript2 = Window( "Log" )[Script Box( 1 )] << get text;
myScript2 = Parse( Substitute(myscript2 , "/*:", "", mydtch, "mydt" ) ); // substitute get noch nicht
Insert Into( myScript, Name Expr( myScript2 ) ));
//I got all infos from the log
Close( elog, noSave );
reports = Associative Array(
Eval List( {Name Expr( Graph Builder() ), Name Expr( Distribution() ), Name Expr( Fit Model() )} ),
{1, 1, 1},
<<set default value( 0 )
);
//remove the useless GraphBuilder Template
For( i = 1, i <= N Arg( myScript ), i++,
If( reports[Head( Arg( Arg( myScript, i ), 2 ) )],
Substitute Into( myScript, Arg( myScript, i ), 1 )
)
);
myReportScript = myScriptableObject << get script();
// wrap the report script and add/hide some info for later
myReportScript = Substitute(
Expr(
New Window( "",
V List Box(
Panel Box( "//steal this code",
<<visibility( "Collapse" ),
Text Box( _dtorig_ ),
Text Box( _code_ )
),
_myReportScript_
)
)
),
Expr( _myReportScript_ ), Name Expr( myReportScript ),
Expr( _dtorig_ ), Char( dtOrig ),
Expr( _code_ ), Char( Name Expr( myScript ) )
);
Insert Into( myScript, Name Expr( myReportScript ) );
// add the generated script to the original table
Eval( Substitute( Expr( dtOrig << New Script( "combined script", _code_ ) ), Expr( _code_ ), Name Expr( myScript ) ) );
dtOrig << Bring Window To Front;
Caption( "find the new script and run it ..." );
wait(0.5);
Caption(remove)
//New window("test",<< Type("Script"),Char(Name Expr(myScript)))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content