This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.
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.
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;
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;
Created:
Jul 20, 2024 12:06 PM
| Last Modified: Jul 24, 2024 10:56 AM(155 views)
| Posted in reply to message from jthi 07-20-2024
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 ....]
// 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)))
'
var data = div.getElementsByClassName("video-js");
var script = document.createElement('script');
script.src = "https://players.brightcove.net/" + data_account + "/" + data_palyer + "_default/index.min.js";
for(var i=0;i< data.length;i++){
videodata.push(data[i]);
}
}
}
for(var i=0;i< videodata.length;i++){
document.getElementsByClassName('lia-vid-container')[i].innerHTML = videodata[i].outerHTML;
document.body.appendChild(script);
}
}
catch(e){
}
/* Re compile html */
$compile(rootElement.querySelectorAll('div.lia-message-body-content')[0])($scope);
}
if (code_l.toLowerCase() != newBody.getAttribute("slang").toLowerCase()) {
/* Adding Translation flag */
var tr_obj = $filter('filter')($scope.sourceLangList, function (obj_l) {
return obj_l.code.toLowerCase() === newBody.getAttribute("slang").toLowerCase()
});
if (tr_obj.length > 0) {
tr_text = "This post originally written in lilicon-trans-text has been computer translated for you. When you reply, it will also be translated back to lilicon-trans-text.".replace(/lilicon-trans-text/g, tr_obj[0].title);
try {
if ($scope.wootMessages[$rootScope.profLang] != undefined) {
tr_text = $scope.wootMessages[$rootScope.profLang].replace(/lilicon-trans-text/g, tr_obj[0].title);
}
} catch (e) {
}
} else {
//tr_text = "This message was translated for your convenience!";
tr_text = "This message was translated for your convenience!";
}
try {
if (!document.getElementById("tr-msz-" + value)) {
var tr_para = document.createElement("P");
tr_para.setAttribute("id", "tr-msz-" + value);
tr_para.setAttribute("class", "tr-msz");
tr_para.style.textAlign = 'justify';
var tr_fTag = document.createElement("IMG");
tr_fTag.setAttribute("class", "tFlag");
tr_fTag.setAttribute("src", "/html/assets/lingoTrFlag.PNG");
tr_fTag.style.marginRight = "5px";
tr_fTag.style.height = "14px";
tr_para.appendChild(tr_fTag);
var tr_textNode = document.createTextNode(tr_text);
tr_para.appendChild(tr_textNode);
/* Woot message only for multi source */
if(rootElement.querySelector(".lia-quilt-forum-message")){
rootElement.querySelector(".lia-quilt-forum-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-message-view-blog-topic-message")) {
rootElement.querySelector(".lia-message-view-blog-topic-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-blog-reply-message")){
rootElement.querySelector(".lia-quilt-blog-reply-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-message")){
rootElement.querySelector(".lia-quilt-tkb-message").appendChild(tr_para);
} else if(rootElement.querySelector(".lia-quilt-tkb-reply-message")){
rootElement.querySelector(".lia-quilt-tkb-reply-message").insertBefore(tr_para,rootElement.querySelector(".lia-quilt-row.lia-quilt-row-footer"));
} else if(rootElement.querySelector(".lia-quilt-idea-message")){
rootElement.querySelector(".lia-quilt-idea-message").appendChild(tr_para);
}else if(rootElement.querySelector(".lia-quilt-column-alley-left")){
rootElement.querySelector(".lia-quilt-column-alley-left").appendChild(tr_para);
}
else {
if (rootElement.querySelectorAll('div.lia-quilt-row-footer').length > 0) {
rootElement.querySelectorAll('div.lia-quilt-row-footer')[0].appendChild(tr_para);
} else {
rootElement.querySelectorAll('div.lia-quilt-column-message-footer')[0].appendChild(tr_para);
}
}
}
} catch (e) {
}
}
} else {
/* Do not display button for same language */
// syncList.remove(value);
var index = $scope.syncList.indexOf(value);
if (index > -1) {
$scope.syncList.splice(index, 1);
}
}
}
}
}
}
angular.forEach(mszList_l, function (value) {
if (document.querySelectorAll('div.lia-js-data-messageUid-' + value).length > 0) {
var rootElements = document.querySelectorAll('div.lia-js-data-messageUid-' + value);
}else if(document.querySelectorAll('.lia-occasion-message-view .lia-component-occasion-message-view').length >0){
var rootElements = document.querySelectorAll('.lia-occasion-message-view .lia-component-occasion-message-view')[0].querySelectorAll('.lia-occasion-description')[0];
}else {
var rootElements = document.querySelectorAll('div.message-uid-' + value);
}
angular.forEach(rootElements, function (rootElement) {
if (value == '774358' && "ForumTopicPage" == "TkbArticlePage") {
rootElement = document.querySelector('.lia-thread-topic');
}
/* V1.1 Remove from UI */
if (document.getElementById("tr-msz-" + value)) {
document.getElementById("tr-msz-" + value).remove();
}
if (document.getElementById("tr-sync-" + value)) {
document.getElementById("tr-sync-" + value).remove();
}
/* XPath expression for subject and Body */
var lingoRBExp = "//lingo-body[@id = " + "'lingo-body-" + value + "'" + "]";
lingoRSExp = "//lingo-sub[@id = " + "'lingo-sub-" + value + "'" + "]";
/* Get translated subject of the message */
lingoRSXML = doc.evaluate(lingoRSExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < lingoRSXML.snapshotLength; i++) {
/* Replace Reply/Comment subject with transalted subject */
var newSub = lingoRSXML.snapshotItem(i);
/*** START : extracting subject from source if selected language and source language is same **/
var sub_L = "";
if (newSub.getAttribute("slang").toLowerCase() == code_l.toLowerCase()) {
if (value == '774358') {
sub_L = decodeURIComponent($scope.sourceContent[value].subject);
}
else{
sub_L = decodeURIComponent($scope.sourceContent[value].subject);
}
} else {
sub_L = newSub.innerHTML;
}
/*** End : extracting subject from source if selected language and source language is same **/
/* This code is placed to remove the extra meta tag adding in the UI*/
try{
sub_L = sub_L.replace('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />','');
}
catch(e){
}
// if($scope.viewTrContentOnly || (newSub.getAttribute("slang").toLowerCase() != code_l.toLowerCase())) {
if ($scope.viewTrContentOnly) {
if ("ForumTopicPage" == "IdeaPage") {
if (value == '774358') {
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
document.querySelector('.MessageSubject .lia-message-subject').innerHTML = sub_L;
}
}
}
if ("ForumTopicPage" == "TkbArticlePage") {
if (value == '774358') {
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
var subTkbElement = document.querySelector('.lia-thread-subject');
if(subTkbElement){
document.querySelector('.lia-thread-subject').innerHTML = sub_L;
}
}
}
}
else if ("ForumTopicPage" == "BlogArticlePage") {
if (value == '774358') {
try {
if((sub_L != "") && (sub_L!= undefined) && (sub_L != "undefined")){
var subElement = rootElement.querySelector('.lia-blog-article-page-article-subject');
if(subElement) {
subElement.innerText = sub_L;
}
}
} catch (e) {
}
/* var subElement = rootElement.querySelectorAll('.lia-blog-article-page-article-subject');
for (var subI = 0; subI < subElement.length; subI++) {
if((sub_L != "") && (sub_L!= undefined) && (sub_L != "undefined")){
subElement[subI].innerHTML = sub_L;
}
} */
}
else {
try {
// rootElement.querySelectorAll('.lia-blog-article-page-article-subject').innerHTML= sub_L;
/** var subElement = rootElement.querySelectorAll('.lia-blog-article-page-article-subject');
for (var j = 0; j < subElement.length; j++) {
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
subElement[j].innerHTML = sub_L;
}
} **/
} catch (e) {
}
}
}
else {
if (value == '774358') {
try{
/* Start: This code is written by iTalent as part of iTrack LILICON - 98 */
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
if(document.querySelectorAll('.lia-quilt-forum-topic-page').length > 0){
if(rootElement.querySelector('div.lia-message-subject').querySelector('h5')){
rootElement.querySelector('div.lia-message-subject').querySelector('h5').innerText = decodeURIComponent(sub_L);
} else {
rootElement.querySelector('.MessageSubject .lia-message-subject').innerText = sub_L;
}
} else {
rootElement.querySelector('.MessageSubject .lia-message-subject').innerText = sub_L;
}
}
/* End: This code is written by iTalent as part of iTrack LILICON - 98 */
}
catch(e){
console.log("subject not available for second time. error details: " + e);
}
} else {
try {
/* Start: This code is written by iTalent as part of LILICON - 98 reported by Ian */
if ("ForumTopicPage" == "IdeaPage") {
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
document.querySelector('.lia-js-data-messageUid-'+ value).querySelector('.MessageSubject .lia-message-subject').innerText = sub_L;
}
}
else{
if( (sub_L != "") && (sub_L != undefined) && (sub_L != "undefined") ){
rootElement.querySelector('.MessageSubject .lia-message-subject').innerText = sub_L;
/* End: This code is written as part of LILICON - 98 reported by Ian */
}
}
} catch (e) {
console.log("Reply subject not available. error details: " + e);
}
}
}
// Label translation
var labelEle = document.querySelector("#labelsForMessage");
if (!labelEle) {
labelEle = document.querySelector(".LabelsList");
}
if (labelEle) {
var listContains = labelEle.querySelector('.label');
if (listContains) {
/* Commenting this code as bussiness want to point search with source language label */
// var tagHLink = labelEle.querySelectorAll(".label")[0].querySelector(".label-link").href.split("label-name")[0];
var lingoLabelExp = "//lingo-label/text()";
trLabels = [];
trLabelsHtml = "";
/* Get translated labels of the message */
lingoLXML = doc.evaluate(lingoLabelExp, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
/* try{
for(var j=0;j,';
}
trLabelsHtml = trLabelsHtml+'