cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Yngeinstn
Level IV

SQL - Insert List from JSL to SQL Query

Good Afternoon,

 

I am running into problems trying to pass a list of selected wafer from JSL into an SQL query. Currently i am able to bring in a single lot and do the data analysis with no problems. However, because i am only able to bring in one single lot i have to basically re-run the script when i want to look at wafers. Translating from JSL to SQL has me stumped and even more sometimes i get errors in the code and sometimes i just get a blank table. I know when i get a blank table the lots are not getting passed into the query. Any assistance would be greatly appreciated. I hope i did an OK job explaining my problems but if i haven't please ask for clarification.

 

// SQL Query  - Insert Multiple Lots from JSL input
testdata_HAY_SS_QQ_L_Data = Expr(
	"
	SELECT DISTINCT
		t1.testdate, 
		t1.wafer_id, 
		t1.wafer_number, 
		t2.rownum, 
		t2.colnum,
		t2.subrow,
		t2.subcol,
		t2.die_id, 
		t2.part_name, 
		t2.testname, 
		t2.set_id, 
		t2.trmode, 
		t2.channel, 
		t3.ts,
		t3.run_id,  
		t3.input, 
		t3.output_1a, 
		t3.output_1b,  
		t3.output_2a,  
		t3.output_2b,  
		t3.output_3a,  
		t3.output_3b, 
		t3.output_4a,  
		t3.output_4b, 
FROM tst_master  t1
	LEFT OUTER JOIN tst_dataset_header t2 
		ON  ( t2.run_id = t1.run_id )
	LEFT OUTER JOIN tst_s_params t3 
		ON  ( t3.header_id = t2.header_id )   
 WHERE (t2.testname LIKE 'test_1')
	AND (t1.wafer_number IN ("||LotListSQLString||") 
// AND (t1.wafer_number LIKE '"||SelectedLot||"') currently use to insert single wafer
	"
);
// Pulls in List of Lots
testdata_HAY_Q_LotList = Expr(
	"
	SELECT DISTINCT t1.wafer_number 
FROM tst_master  t1 
	LEFT OUTER JOIN tst_dataset_header t2 
		ON  ( t2.run_id = t1.run_id )
	WHERE t1.wafer_number RLIKE '-ATL'
	"
);

dt_LotList = Open Database( <db_connection>, testdata_HAY_Q_LotList, "LotList", Invisible );
Summarize( LotList = By (:wafer_number ));
Insert Into( LotList, "<Select Lot>", 1);
Close (dt_lotlist, No Save);

// Choose Your Lot

doListChoice = expr(
	SelectedLot = LotListBox << getSelected;
	show(SelectedLot);
);

//LotListBox = ComboBox(LotList, doListChoice); // used to insert single lot

LotListBox = CheckBox(LotList, doListChoice);

win = New Window( "DataBase",
//	<<Modal,
	<<ReturnResult, // ensures that you get the same result as with Dialog
	V List Box(
		V List Box(
			Text Box( "Welcome to the Database" ),
			Line Up Box(
				NCol( 1 ),
				Panel Box(" Lot Number ",LotListBox ),
				Panel Box( "Test Type",
					Button Box( "test_1", test_doSelection_ss),
					Button Box( "test_2", test_doSelection_nf),
					Button Box( "test_3", test_doSelection_dc),
					Button Box( "test_4", doSelection_TIME.TEST),
					Button Box( "test_4", doSelection_BIT.TEST),
					Button Box( "test_5", doSelection_GCA.TEST),
				)
			)
		),
		
		H List Box(
			Align( Right ),
			Spacer Box(),
				Button Box( "Exit", win << Close Window),
		)
	)
);

// Attempt to pass multiple lots to SQL query 
LotListSQLString = SelectedLot[1];
for(i = 2, i<= N Items(SelectedLot), i++, LotListSQLString = (LotListSQLString||",'"||Char(SelectedLot[i])||"'") );
Show(LotListSQLString);


1 REPLY 1
Yngeinstn
Level IV

Re: SQL - Insert List from JSL to SQL Query

Did I miss something?