<?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: Offset Site 1 data in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540066#M76073</link>
    <description>&lt;P&gt;You need to either step through the code using the Show() function to see what values are being set to and then determine where your logic is going wrong, or use the JMP Debugger to do the analysis with.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is the method that I or anyone else on the forum would have to do.&amp;nbsp; And you have the advantage of understanding what you expect the output to be.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2022 20:24:03 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-09-02T20:24:03Z</dc:date>
    <item>
      <title>Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539820#M76065</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a jmp script that offsets the test results based upon the reference data table values.&lt;/P&gt;&lt;P&gt;It will:&lt;/P&gt;&lt;P&gt;1. Read data table and reference data table&lt;/P&gt;&lt;P&gt;2. Generate a new window to select site number,&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Based on the user input (Site Number 1 or 2), align those data to the reference data table values&lt;/P&gt;&lt;P&gt;&amp;nbsp;Take mean by wafer Id, apply the offset to the main data table&lt;/P&gt;&lt;P&gt;Here's the script: It doesn't produces expected output&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Data Table( "Reference data table" );
dt2 = Current Data Table();

For( i = 1, i &amp;lt;= N Rows( dt1 ), i++,
	theTest = dt1:Tests[i];
	Try( Column( dt2, theTest ) &amp;lt;&amp;lt; set property( "TheMean", dt1:mean[i] ) );
);
		New window( "", modal,
			ct = checkbox({"1","2"}),
			Buttonbox ("Ok",
				get = ct &amp;lt;&amp;lt; Get Selected ();
			)
	
	
);
sitenum = Transform Each({str}, get, Num(str));	
Col_List1 = dt2 &amp;lt;&amp;lt; Get Column Names( "String" );
For( c = 1, c &amp;lt;= N Col( dt2 ) - 1, c++,
	theMatrix = [];
	name = Column( Col_List1[c] ) &amp;lt;&amp;lt; Get name;
	If( Contains( Col_List1[c], "IL" ), 
	
		mean = .;
		Try( mean = Column( dt2, col_list1[c] ) &amp;lt;&amp;lt; get property( "theMean" ) );
		// Don't process if a value for theMean does not exist
		If( Is Missing( mean ) == 0,
			For Each Row(
			If( Contains(sitenum, dt2:SiteNumber), // Something needs to be changed here *****
				r = Row();
		//mean = dt1:Mean[dt1 &amp;lt;&amp;lt; Get Rows Where( :Tests == name )];
		
				//measure = mean - Col Mean( If( dt2:Strips == dt2:Strips[r], Column( dt2, c ), . ) );
				measure = mean - Col Mean( As Column( dt2, c ), :Wafer ID );
				theMatrix = theMatrix || Column( dt2, c )[r] + measure;
			);
			);
			Column( dt2, c ) &amp;lt;&amp;lt; Set Values( theMatrix );
		);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:09:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539820#M76065</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2023-06-09T17:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539852#M76067</link>
      <description>&lt;P&gt;The way I would handle this would be to put show statements in the code to determine at what point I am failing to get correct results.&amp;nbsp; For example, after transform each, put show(sitenum).&amp;nbsp; This way you can trace through the progression of the logic and see where it fails.&amp;nbsp; Alternatively you can use the debugger tool to perform the same task.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 14:37:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539852#M76067</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2022-09-02T14:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539934#M76068</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;appreciate if you can advice&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 17:22:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/539934#M76068</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-09-02T17:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540043#M76070</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Data Table( "Reference data table" );
dt2 = Current Data Table();

For( i = 1, i &amp;lt;= N Rows( dt1 ), i++,
	theTest = dt1:Tests[i];
	Try( Column( dt2, theTest ) &amp;lt;&amp;lt; set property( "TheMean", dt1:mean[i] ) );
);
New Window( "",
	modal,
	ct = Check Box( {"1", "2"} ),
	Button Box( "Ok", get = ct &amp;lt;&amp;lt; Get Selected() )
	
	
);


sitenum = Transform Each( {str}, get, Num( str ) );
Col_List1 = dt2 &amp;lt;&amp;lt; Get Column Names( "String" );
For( c = 1, c &amp;lt;= N Col( dt2 ) - 1, c++,
	theMatrix = [];
	name = Column( Col_List1[c] ) &amp;lt;&amp;lt; Get name;
	
	// The following code is never executed since none of the column names
	// have the value "IL" in their name
	If( Contains( Col_List1[c], "IL" ), 
		mean = .;
		Try( mean = Column( dt2, col_list1[c] ) &amp;lt;&amp;lt; get property( "theMean" ) );
		// Don't process if a value for theMean does not exist
		If( Is Missing( mean ) == 0,
			For Each Row(
				If( Contains( sitenum, dt2:SiteNumber ), // Something needs to be changed here *****
					r = Row();
		//mean = dt1:Mean[dt1 &amp;lt;&amp;lt; Get Rows Where( :Tests == name )];
		
					//measure = mean - Col Mean( If( dt2:Strips == dt2:Strips[r], Column( dt2, c ), . ) );
					measure = mean - Col Mean( As Column( dt2, c ), :Wafer ID );
					theMatrix = theMatrix || Column( dt2, c )[r] + measure;
				)
			);
			Column( dt2, c ) &amp;lt;&amp;lt; Set Values( theMatrix );
		);
	);
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 19:12:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540043#M76070</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-09-02T19:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540060#M76071</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;Sorry. There was a typo in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the correct statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// The following code is never executed since none of the column names
	// have the value "IL" in their name
	If( Contains( Col_List1[c], "Current" ), &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 19:56:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540060#M76071</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-09-02T19:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540066#M76073</link>
      <description>&lt;P&gt;You need to either step through the code using the Show() function to see what values are being set to and then determine where your logic is going wrong, or use the JMP Debugger to do the analysis with.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is the method that I or anyone else on the forum would have to do.&amp;nbsp; And you have the advantage of understanding what you expect the output to be.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 20:24:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540066#M76073</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-09-02T20:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540931#M76136</link>
      <description>&lt;P&gt;You might also use the &lt;A href="https://www.jmp.com/support/help/en/16.2/#page/jmp/debug-or-profile-scripts.shtml#" target="_self"&gt;JMP Debugger&lt;/A&gt; to examine or watch variables using breakpoints or stepping through the code.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 12:17:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540931#M76136</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-09-06T12:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Offset Site 1 data</title>
      <link>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540969#M76140</link>
      <description>&lt;P&gt;You should really learn how to ask better questions...and learn how to debug scripts. Having said that, here is a working script that does what you need:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Data Table( "Reference data table" );
dt2 = Current Data Table();

For( i = 1, i &amp;lt;= N Rows( dt1 ), i++,
	theTest = dt1:Tests[i];
	Try( Column( dt2, theTest ) &amp;lt;&amp;lt; set property( "TheMean", dt1:mean[i] ) );
);

New Window( "",
	modal,
	ct = Check Box( {"1", "2"} ),
	Button Box( "Ok", get = ct &amp;lt;&amp;lt; Get Selected() )
	
	
);

sitenum = Transform Each( {str}, get, Num( str ) );
Col_List1 = dt2 &amp;lt;&amp;lt; Get Column Names( "String" );
For( c = 1, c &amp;lt;= N Col( dt2 ) - 1, c++,
	If( Contains( Col_List1[c], "Current" ),
		mean = .;
		Try( mean = Column( dt2, col_list1[c] ) &amp;lt;&amp;lt; get property( "theMean" ) );
		// Don't process if a value for theMean does not exist
		If( !Is Missing( mean ),
			For(k=1, k&amp;lt;= n items(sitenum), k++,
				rows = dt2 &amp;lt;&amp;lt; Select Where( :SiteNumber == sitenum[k] ) &amp;lt;&amp;lt; Get Selected Rows;
				dt2 &amp;lt;&amp;lt; Clear Select();
				NewValues = Column( dt2, c )[rows]+mean;
				For(i=1, i&amp;lt;= n items(NewValues), i++,
					Column( dt2, c )[rows[i]] = NewValues[i]
				);
			);
		);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:19:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Offset-Site-1-data/m-p/540969#M76140</guid>
      <dc:creator>pauldeen</dc:creator>
      <dc:date>2022-09-06T13:19:33Z</dc:date>
    </item>
  </channel>
</rss>

