<?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: Strange behavior - Name of existing constant is unresolved under certain conditions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/355796#M60572</link>
    <description>&lt;P&gt;Is there a reason why you cannot open the window or is the issue just the visibility of window and it popping up?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could hide it with&lt;EM&gt; &amp;lt;&amp;lt; Show Window(0)&lt;/EM&gt; and close after saving:&lt;/P&gt;&lt;PRE&gt;window = New Window( "My Report", &amp;lt;&amp;lt; show window(0), imageForReport ); &lt;BR /&gt;window &amp;lt;&amp;lt; save picture( "C:\temp\testImage.png", "png" );&lt;BR /&gt;window &amp;lt;&amp;lt; Close Window;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Feb 2021 06:41:45 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-02-04T06:41:45Z</dc:date>
    <item>
      <title>Strange behavior - Name of existing constant is unresolved under certain conditions</title>
      <link>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/355734#M60569</link>
      <description>&lt;P&gt;I have a BorderBox filled with Graph Builder, that I want to save as picture.&lt;/P&gt;&lt;P&gt;I have an "Add Graphics Script" on a FrameBox in it. This script uses variables:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Graph Builder(
					Size( 600, 400 ),
					Show Control Panel( 0 ),
					Show Legend( 0 ),
					Title Alignment( "Right" ),
					Variables( X( :X ), Y( :Y ), Overlay( :Overlay ) ),
					Elements(
						Contour( X, Y, Legend( 5 ), Number of Levels( 18 ), Smoothness( -0.8899 ) ),
						Points( X, Y, Legend( 4 ) )
					),
SendToReport(
Dispatch(
							{},
							"Graph Builder",
							FrameBox,
							{Marker Size( 1 ), Add Graphics Script(
								Transparency( 0.5 );
								Fill Color( "Green" );
								Pen Color( "Dark Green" );
								Line(
									{marginXmin, marginYmin},
									{marginXmin, marginYmax},
									{marginXmax, marginYmax},
									{marginXmax, marginYmin}
									{marginXmin, marginYmin}
								);
							)}
						)

				),&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I open a new window with the BorderBox called "imageForReport" that has this GraphBuilder in it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;window = New Window( "My Report", imageForReport );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and then save the report in the image:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;imageForReport &amp;lt;&amp;lt; save picture( imgPath, "png" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;everything is fine and everything is working.&lt;/P&gt;&lt;P&gt;But I only need that window to debug on the fly, the final product is the PNG image file.&lt;/P&gt;&lt;P&gt;So for the production version that runs thousands of reports I save on resources and do not open that window.&lt;/P&gt;&lt;P&gt;But in this case the graphic script doesn't work because the first variable (and I guess the rest of them) is not resolved. I get this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Name Unresolved: marginXmin in access or evaluation of 'marginXmin' , marginXmin/*###*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;in the Log window. How do I fix that without unnecessary opening and closing thousands of windows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UPDATE:&lt;/P&gt;&lt;P&gt;Here's a sample script to test this behavior:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Log();
Clear Symbols();
Clear Globals();
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
cutOutX = 20;
cutOutY = 3;
marginXmin = 70;
marginXmax = 160;
marginYmin = 55;
marginYmax = 65;

imageForReport = Border Box(
	VLBox = V List Box(
		//Zero row
		headerTB = Text Box( "Test savingimage" ),
		gb = Graph Builder(
			Size( 528, 456 ),
			Show Control Panel( 0 ),
			Variables( X( :weight ), Y( :height ) ),
			Elements( Points( X, Y, Legend( 6 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"Graph Builder",
					FrameBox,
					{Marker Size( 1 ), Add Graphics Script(
						Transparency( 0.5 );
						Fill Color( "Green" );
						Pen Color( "Dark Green" );
						Line(
									{marginXmin, marginYmin},
									{marginXmin, (marginYmax - cutOutY)},
									{(marginXmin + cutOutX), (marginYmax - cutOutY)},
									{(marginXmin + cutOutX), marginYmax},
									{(marginXmax - cutOutX), marginYmax},
									{(marginXmax - cutOutX), (marginYmax - cutOutY)},
									{marginXmax, (marginYmax - cutOutY)},
									{marginXmax, marginYmin},
									{marginXmin, marginYmin}
								);
					)}
				)	
		
			)
		)
	)
);


window = New Window( "My Report", imageForReport );	
imageForReport &amp;lt;&amp;lt; save picture( "C:\temp\testImage.png", "png" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If ran as it is - it will open window with the plot and shape in it and it will save PNG image with plot and shape.&lt;/P&gt;&lt;P&gt;If you comment the new window line - it will save plot to PNG image without opening a new window, but the shape will be missing in it.&lt;/P&gt;&lt;P&gt;Can anybody explain it and how to solve it? How to get shape in the saved image without having to open\close new window with the plot?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:10:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/355734#M60569</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-11T11:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior - Name of existing constant is unresolved under certain conditions</title>
      <link>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/355796#M60572</link>
      <description>&lt;P&gt;Is there a reason why you cannot open the window or is the issue just the visibility of window and it popping up?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could hide it with&lt;EM&gt; &amp;lt;&amp;lt; Show Window(0)&lt;/EM&gt; and close after saving:&lt;/P&gt;&lt;PRE&gt;window = New Window( "My Report", &amp;lt;&amp;lt; show window(0), imageForReport ); &lt;BR /&gt;window &amp;lt;&amp;lt; save picture( "C:\temp\testImage.png", "png" );&lt;BR /&gt;window &amp;lt;&amp;lt; Close Window;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2021 06:41:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/355796#M60572</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-02-04T06:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior - Name of existing constant is unresolved under certain conditions</title>
      <link>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/356047#M60591</link>
      <description>&lt;P&gt;Yes, there is a reason.&lt;/P&gt;&lt;P&gt;This script runs scheduled and in the background, processing tens of thousands of reports like that, some plots on tables with millions of rows. I noticed that NOT drawing windows saves a LOT of processing time. Plus it's absolutely unnecessary - nobody looks at these thousands of windows popping up several hours straight at night.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect that drawing window does something similar to Evaluate() to Display Boxes and without it the variables in Display Boxes are not evaluated. Any way to get a similar effect without actually opening window?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 17:19:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/356047#M60591</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2021-02-04T17:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior - Name of existing constant is unresolved under certain conditions</title>
      <link>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/356050#M60592</link>
      <description>Actually, let me test it, maybe NOT showing window as you suggested will also save on processing time</description>
      <pubDate>Thu, 04 Feb 2021 17:22:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strange-behavior-Name-of-existing-constant-is-unresolved-under/m-p/356050#M60592</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2021-02-04T17:22:25Z</dc:date>
    </item>
  </channel>
</rss>

