cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Bluebird73
Level I

Name Unresolved for column name when using Match function

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/*###*/"

 

SamplePoint is the column I'm trying to recode

 

Here is the full code: 

//!
 
Names Default To Here( 1 );
delete symbols();
 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to pull data based on analysis 
AnalysisData = Function( {analysisinput},
	New SQL Query(
		Connection( <ommitted> ),
		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" ) ) )
			) & Custom( "ID_NUMERIC > 15012", UI( Custom( Base( "Categorical" ) ) ) )
		)
	) << Run
); // end of function

 
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
 
//function to format data
FormatTrial = Function( {dt}, 
 
	dt33 = dt << 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 << New Column( "Trial ID", Character, Formula( Left( :Z_TRIAL, 4 ) ) );
 
// new column for sample location
	dt33 << New Column( "SamplePoint", Character, Formula( Right( Left( :Z_TRIAL, 8 ), 3 ) ) );
	:SamplePoint << Delete Formula;
 
// new column for sample number
	dt33 << New Column( "Sample #", Character, Formula( Right( :Z_TRIAL, 3 ) ) );
	:"Sample #" << Delete Formula;
 
// move new columns to left
	collist = {"Trial ID", "SamplePoint", "Sample #"};
	dt33 << Move Selected Columns( collist, To First );
 
	dt33 << select where( Is Missing( :"Trial ID" ) );
	dt33 << 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 << Row Selection(
	Select where( :NAME == "Span" | Contains( :NAME, "Check D" ) ),
	Match case( 0 ),
	Dialog( Edit( Equal( Source Column( :NAME ) ) ) )
);
dt10 << Invert Row Selection << Delete Rows;
 
FormatTrial( dt10 ); 
 
//psa formatting
dt33:"Check D10 (avg of 5 replicates)" << set name( "d10" );
dt33:"Check D50 (avg of 5 replicates)" << set name( "d50" );
dt33:"Check D90 (avg of 5 replicates)" << set name( "d90" );
dt33:"Check Dmax (avg of 5 replicates)" << set name( "dmax" );
dt33:"Check Dmin (avg of 5 replicates)" << set name( "dmin" );
dt33 << Set Name( "PSD Data" );
 
SampleInfo( dt10 );
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Name Unresolved for column name when using Match function

I think this may be a scoping issue.  Try placing a ":" (colon) in front of SamplePoint whenever you are referencing it as a column name.

 

Note:  Please enter JSL by using the JSL icon at the top of the Preview Window.  It allows for readers to more easily read the code.

Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Name Unresolved for column name when using Match function

I think this may be a scoping issue.  Try placing a ":" (colon) in front of SamplePoint whenever you are referencing it as a column name.

 

Note:  Please enter JSL by using the JSL icon at the top of the Preview Window.  It allows for readers to more easily read the code.

Jim