<?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 Name Unresolved for column name when using Match function in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Name-Unresolved-for-column-name-when-using-Match-function/m-p/730637#M91353</link>
    <description>&lt;P&gt;Hi, I have a script that pulls a query then I attempt to recode some of the query information. whenever I run the "match" function in a separate script it works but when I combine it into my full script I get the error: "Name Unresolved: SamplePoint at row 1 in access or evaluation of 'SamplePoint' , SamplePoint/*###*/"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SamplePoint is the column I'm trying to recode&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the full code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//!
 
Names Default To Here( 1 );
delete symbols();
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to pull data based on analysis 
AnalysisData = Function( {analysisinput},
	New SQL Query(
		Connection( &amp;lt;ommitted&amp;gt; ),
		QueryName( "TEST" ),
		Select(
			Column( "ANALYSIS", "t1" ),
			Column( "VALUE", "t3" ),
			Column( "Z_TRIAL", "t2" ),
			Column( "NAME", "t3" ),
			Column( "ID_NUMERIC", "t2" )
		),
		From(
			Table( "TEST", Schema( "dbo" ), Alias( "t1" ) ),
			Table(
				"RESULT",
				Schema( "dbo" ),
				Alias( "t3" ),
				Join( Type( Left Outer ), EQ( Column( "TEST_NUMBER", "t1" ), Column( "TEST_NUMBER", "t3" ) ) )
			),
			Table(
				"SAMPLE",
				Schema( "dbo" ),
				Alias( "t2" ),
				Join( Type( Left Outer ), EQ( Column( "SAMPLE", "t1" ), Column( "ID_NUMERIC", "t2" ) ) )
			)
		),
		Where(
			In List(
				Column( "ANALYSIS", "t1" ),
				{analysisinput},
				UI( SelectListFilter( ListBox, Base( "Categorical" ) ) )
			) &amp;amp; Custom( "ID_NUMERIC &amp;gt; 15012", UI( Custom( Base( "Categorical" ) ) ) )
		)
	) &amp;lt;&amp;lt; Run
); // end of function

 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to format data
FormatTrial = Function( {dt}, 
 
	dt33 = dt &amp;lt;&amp;lt; Split(
		Split By( :NAME ),
		Split( :VALUE ),
		Group( :Z_TRIAL ),
		Remaining Columns( Drop All ),
		Sort by Column Property
	);
 
	Close( Data Table( "TEST" ), NoSave );
	Wait( 3 );
 
// new column for trial id
	dt33 &amp;lt;&amp;lt; New Column( "Trial ID", Character, Formula( Left( :Z_TRIAL, 4 ) ) );
 
// new column for sample location
	dt33 &amp;lt;&amp;lt; New Column( "SamplePoint", Character, Formula( Right( Left( :Z_TRIAL, 8 ), 3 ) ) );
	:SamplePoint &amp;lt;&amp;lt; Delete Formula;
 
// new column for sample number
	dt33 &amp;lt;&amp;lt; New Column( "Sample #", Character, Formula( Right( :Z_TRIAL, 3 ) ) );
	:"Sample #" &amp;lt;&amp;lt; Delete Formula;
 
// move new columns to left
	collist = {"Trial ID", "SamplePoint", "Sample #"};
	dt33 &amp;lt;&amp;lt; Move Selected Columns( collist, To First );
 
	dt33 &amp;lt;&amp;lt; select where( Is Missing( :"Trial ID" ) );
	dt33 &amp;lt;&amp;lt; Delete Rows;
 
);// end of function
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to recode columns
SampleInfo = Function( {dts}, 
 
// recode the sample location
	For Each Row(
		SamplePoint = Match( SamplePoint,
			"100", "RP",
			"101", "RCP",
			"102", "RL",
			"103", "RCL",
			"104", "RLM",
			"105", "FTR1",
			"106", "FTR2",
			"107", "FTR3",
			"108", "FTR4",
			"109", "ML",
			"110", "M1",
			"111", "M2",
			"112", "MW",
			"113", "M2W",
			"115", "DCt",
			"116", "DCr",
			"117", "DE",
			"N/A"
		)
	);
 
); // end of function
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
fai = "TM-006";
AnalysisData( fai );
 
dt10 = Current Data Table();
dt10 &amp;lt;&amp;lt; Row Selection(
	Select where( :NAME == "Span" | Contains( :NAME, "Check D" ) ),
	Match case( 0 ),
	Dialog( Edit( Equal( Source Column( :NAME ) ) ) )
);
dt10 &amp;lt;&amp;lt; Invert Row Selection &amp;lt;&amp;lt; Delete Rows;
 
FormatTrial( dt10 ); 
 
//psa formatting
dt33:"Check D10 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d10" );
dt33:"Check D50 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d50" );
dt33:"Check D90 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d90" );
dt33:"Check Dmax (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "dmax" );
dt33:"Check Dmin (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "dmin" );
dt33 &amp;lt;&amp;lt; Set Name( "PSD Data" );
 
SampleInfo( dt10 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Mar 2024 19:09:17 GMT</pubDate>
    <dc:creator>Bluebird73</dc:creator>
    <dc:date>2024-03-07T19:09:17Z</dc:date>
    <item>
      <title>Name Unresolved for column name when using Match function</title>
      <link>https://community.jmp.com/t5/Discussions/Name-Unresolved-for-column-name-when-using-Match-function/m-p/730637#M91353</link>
      <description>&lt;P&gt;Hi, I have a script that pulls a query then I attempt to recode some of the query information. whenever I run the "match" function in a separate script it works but when I combine it into my full script I get the error: "Name Unresolved: SamplePoint at row 1 in access or evaluation of 'SamplePoint' , SamplePoint/*###*/"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SamplePoint is the column I'm trying to recode&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the full code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//!
 
Names Default To Here( 1 );
delete symbols();
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to pull data based on analysis 
AnalysisData = Function( {analysisinput},
	New SQL Query(
		Connection( &amp;lt;ommitted&amp;gt; ),
		QueryName( "TEST" ),
		Select(
			Column( "ANALYSIS", "t1" ),
			Column( "VALUE", "t3" ),
			Column( "Z_TRIAL", "t2" ),
			Column( "NAME", "t3" ),
			Column( "ID_NUMERIC", "t2" )
		),
		From(
			Table( "TEST", Schema( "dbo" ), Alias( "t1" ) ),
			Table(
				"RESULT",
				Schema( "dbo" ),
				Alias( "t3" ),
				Join( Type( Left Outer ), EQ( Column( "TEST_NUMBER", "t1" ), Column( "TEST_NUMBER", "t3" ) ) )
			),
			Table(
				"SAMPLE",
				Schema( "dbo" ),
				Alias( "t2" ),
				Join( Type( Left Outer ), EQ( Column( "SAMPLE", "t1" ), Column( "ID_NUMERIC", "t2" ) ) )
			)
		),
		Where(
			In List(
				Column( "ANALYSIS", "t1" ),
				{analysisinput},
				UI( SelectListFilter( ListBox, Base( "Categorical" ) ) )
			) &amp;amp; Custom( "ID_NUMERIC &amp;gt; 15012", UI( Custom( Base( "Categorical" ) ) ) )
		)
	) &amp;lt;&amp;lt; Run
); // end of function

 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to format data
FormatTrial = Function( {dt}, 
 
	dt33 = dt &amp;lt;&amp;lt; Split(
		Split By( :NAME ),
		Split( :VALUE ),
		Group( :Z_TRIAL ),
		Remaining Columns( Drop All ),
		Sort by Column Property
	);
 
	Close( Data Table( "TEST" ), NoSave );
	Wait( 3 );
 
// new column for trial id
	dt33 &amp;lt;&amp;lt; New Column( "Trial ID", Character, Formula( Left( :Z_TRIAL, 4 ) ) );
 
// new column for sample location
	dt33 &amp;lt;&amp;lt; New Column( "SamplePoint", Character, Formula( Right( Left( :Z_TRIAL, 8 ), 3 ) ) );
	:SamplePoint &amp;lt;&amp;lt; Delete Formula;
 
// new column for sample number
	dt33 &amp;lt;&amp;lt; New Column( "Sample #", Character, Formula( Right( :Z_TRIAL, 3 ) ) );
	:"Sample #" &amp;lt;&amp;lt; Delete Formula;
 
// move new columns to left
	collist = {"Trial ID", "SamplePoint", "Sample #"};
	dt33 &amp;lt;&amp;lt; Move Selected Columns( collist, To First );
 
	dt33 &amp;lt;&amp;lt; select where( Is Missing( :"Trial ID" ) );
	dt33 &amp;lt;&amp;lt; Delete Rows;
 
);// end of function
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to recode columns
SampleInfo = Function( {dts}, 
 
// recode the sample location
	For Each Row(
		SamplePoint = Match( SamplePoint,
			"100", "RP",
			"101", "RCP",
			"102", "RL",
			"103", "RCL",
			"104", "RLM",
			"105", "FTR1",
			"106", "FTR2",
			"107", "FTR3",
			"108", "FTR4",
			"109", "ML",
			"110", "M1",
			"111", "M2",
			"112", "MW",
			"113", "M2W",
			"115", "DCt",
			"116", "DCr",
			"117", "DE",
			"N/A"
		)
	);
 
); // end of function
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
fai = "TM-006";
AnalysisData( fai );
 
dt10 = Current Data Table();
dt10 &amp;lt;&amp;lt; Row Selection(
	Select where( :NAME == "Span" | Contains( :NAME, "Check D" ) ),
	Match case( 0 ),
	Dialog( Edit( Equal( Source Column( :NAME ) ) ) )
);
dt10 &amp;lt;&amp;lt; Invert Row Selection &amp;lt;&amp;lt; Delete Rows;
 
FormatTrial( dt10 ); 
 
//psa formatting
dt33:"Check D10 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d10" );
dt33:"Check D50 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d50" );
dt33:"Check D90 (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "d90" );
dt33:"Check Dmax (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "dmax" );
dt33:"Check Dmin (avg of 5 replicates)" &amp;lt;&amp;lt; set name( "dmin" );
dt33 &amp;lt;&amp;lt; Set Name( "PSD Data" );
 
SampleInfo( dt10 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2024 19:09:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Name-Unresolved-for-column-name-when-using-Match-function/m-p/730637#M91353</guid>
      <dc:creator>Bluebird73</dc:creator>
      <dc:date>2024-03-07T19:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Name Unresolved for column name when using Match function</title>
      <link>https://community.jmp.com/t5/Discussions/Name-Unresolved-for-column-name-when-using-Match-function/m-p/730747#M91356</link>
      <description>&lt;P&gt;I think this may be a scoping issue.&amp;nbsp; Try placing a ":" (colon) in front of SamplePoint whenever you are referencing it as a column name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note:&amp;nbsp; Please enter JSL by using the JSL icon at the top of the Preview Window.&amp;nbsp; It allows for readers to more easily read the code.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 19:20:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Name-Unresolved-for-column-name-when-using-Match-function/m-p/730747#M91356</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-07T19:20:06Z</dc:date>
    </item>
  </channel>
</rss>

