<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [JSL] Save New Window () as script in a data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802332#M97857</link>
    <description>&lt;P&gt;I would say that generally it is easiest to just build the new window as expression and add that to table script. This method will always work but sometimes it will require some extra work (or most of the time)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

oldlastrecord = {"abc"};
newlastrecord = {"ABC"};
Ndata = [123];

report_expr = Eval Expr(
	ReportMsg = New Window("Station ---", 
		//&amp;lt;&amp;lt;modal(),
		Outline Box("Data Pull Report",
			Table Box(
				String Col Box("Previous Last record", Expr(oldlastrecord)),
				String Col Box("New Last record", Expr(newlastrecord)),
				Number Col Box("# new rows", Expr(Ndata))
			)
		)
	)
);

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("My Report", Expr(NameExpr(report_expr)));
));

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 Sep 2024 15:13:55 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-09-27T15:13:55Z</dc:date>
    <item>
      <title>[JSL] Save New Window () as script in a data table</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802224#M97840</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to save a small report generated as New Window () as script into the data table, after concatenation, so I can generate it later from the datable directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Voizingu_0-1727422912196.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68654i7058F430355E47A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Voizingu_0-1727422912196.png" alt="Voizingu_0-1727422912196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying the function&amp;nbsp;&lt;EM&gt;&amp;lt;&amp;lt; get script and &amp;lt;&amp;lt; new script&amp;nbsp;&lt;/EM&gt;but it doesn't work, the generated script fails.&lt;/P&gt;&lt;P&gt;could you please help me?&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- voiz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "datatable_test5",
	Add Rows( 7 ),
	New Column( "SerialNumber",
		Character( 20 ),
		"Nominal",
		Set Values(
			{"DN802111YSKQ45752507", "DN802111YSKQ45752507",
			"DN802111YSKQ45752507", "DN802111YSQQ4575X379",
			"DN802111YSQQ4575X379", "DN802111YSQQ4575X379",
			"DN802111YUAQ45755340"}
		),
		Set Display Width( 233 )
	),
	New Column( "stored_at",
		Numeric,
		"Continuous",
		Format( "y/m/d h:m:s", 22, 0 ),
		Input Format( "y/m/d h:m:s", 0 ),
		Set Values(
			[3806904000, 3806990820, 3806904780, 3806905200, 3806992020,
			3806906400, 3806906820]
		),
		Set Display Width( 169 )
	),
	New Column( "Version",
		Character( 9 ),
		"Nominal",
		Set Values(
			{"Version 3", "Version 1", "Version 2", "Version 5",
			"Version 4", "Version 2", "Version 3"}
		),
		Set Display Width( 100 )
	),
	New Column( "Metric1",
		Numeric,
		"Continuous",
		Format( "Best", 10 ),
		Set Property(
			"Spec Limits",
			{LSL( 0 ), USL( 40 ), Show Limits( 1 )}
		),
		Set Values(
			[16.197252, 6.39561587, 6.5805566, 6.1837729, 16.3159215,
			12.7256798, 9.83716952]
		),
		Set Display Width( 110 )
	)
);

oldlastrecord= format(Col Maximum(dt:stored_at), "y/m/d h:m:s");
Newlastrecord= format(today(), "y/m/d h:m:s");
Ndata = Nrows(dt);

ReportMsg = New Window( "Station ---",
	//&amp;lt;&amp;lt;modal(),
	Outline Box( "Data Pull Report",
		Table Box(
			String Col Box( "Previous Last record", oldlastrecord ),
			String Col Box( "New Last record", newlastrecord ),
			Number Col Box( "# new rows", Ndata )
		)
	)
);

ReportScript = ReportMsg &amp;lt;&amp;lt; get script;

show(ReportScript); // &amp;lt;-- the format of the script (see log) is very different from ReportMsg above

//Attempt at saving the script &amp;lt;--- fail
//Eval( Eval Expr( dt &amp;lt;&amp;lt; New Script( "Data Pull Report", Expr( ReportScript )) ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the log generates the following&amp;nbsp;&lt;/P&gt;&lt;P&gt;ReportScript =&lt;/P&gt;&lt;P&gt;V List Box(&lt;/P&gt;&lt;P&gt;V List Box(&lt;/P&gt;&lt;P&gt;OutlineBox(&lt;/P&gt;&lt;P&gt;TableBox(&lt;/P&gt;&lt;P&gt;StringColBox("2024/08/20 9:47:00 AM"),&lt;/P&gt;&lt;P&gt;StringColBox("2024/09/27 12:41:40 AM"),&lt;/P&gt;&lt;P&gt;NumberColBox(Set Format("Best", 7), Array(7)&lt;/P&gt;&lt;P&gt;)))));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 07:48:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802224#M97840</guid>
      <dc:creator>Voizingu</dc:creator>
      <dc:date>2024-09-27T07:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Save New Window () as script in a data table</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802332#M97857</link>
      <description>&lt;P&gt;I would say that generally it is easiest to just build the new window as expression and add that to table script. This method will always work but sometimes it will require some extra work (or most of the time)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

oldlastrecord = {"abc"};
newlastrecord = {"ABC"};
Ndata = [123];

report_expr = Eval Expr(
	ReportMsg = New Window("Station ---", 
		//&amp;lt;&amp;lt;modal(),
		Outline Box("Data Pull Report",
			Table Box(
				String Col Box("Previous Last record", Expr(oldlastrecord)),
				String Col Box("New Last record", Expr(newlastrecord)),
				Number Col Box("# new rows", Expr(Ndata))
			)
		)
	)
);

Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("My Report", Expr(NameExpr(report_expr)));
));

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Sep 2024 15:13:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802332#M97857</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-27T15:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: [JSL] Save New Window () as script in a data table</title>
      <link>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802422#M97876</link>
      <description>&lt;P&gt;Hi Jarmo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot it works great :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 21:50:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JSL-Save-New-Window-as-script-in-a-data-table/m-p/802422#M97876</guid>
      <dc:creator>Voizingu</dc:creator>
      <dc:date>2024-09-27T21:50:00Z</dc:date>
    </item>
  </channel>
</rss>

