<?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 SQL - Insert List from JSL to SQL Query in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/SQL-Insert-List-from-JSL-to-SQL-Query/m-p/63445#M34001</link>
    <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;OK job explaining my problems but if i haven't please ask for clarification.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// 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( &amp;lt;db_connection&amp;gt;, testdata_HAY_Q_LotList, "LotList", Invisible );
Summarize( LotList = By (:wafer_number ));
Insert Into( LotList, "&amp;lt;Select Lot&amp;gt;", 1);
Close (dt_lotlist, No Save);

// Choose Your Lot

doListChoice = expr(
	SelectedLot = LotListBox &amp;lt;&amp;lt; getSelected;
	show(SelectedLot);
);

//LotListBox = ComboBox(LotList, doListChoice); // used to insert single lot

LotListBox = CheckBox(LotList, doListChoice);

win = New Window( "DataBase",
//	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;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 &amp;lt;&amp;lt; Close Window),
		)
	)
);

// Attempt to pass multiple lots to SQL query 
LotListSQLString = SelectedLot[1];
for(i = 2, i&amp;lt;= N Items(SelectedLot), i++, LotListSQLString = (LotListSQLString||",'"||Char(SelectedLot[i])||"'") );
Show(LotListSQLString);


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Jul 2018 17:18:29 GMT</pubDate>
    <dc:creator>Yngeinstn</dc:creator>
    <dc:date>2018-07-19T17:18:29Z</dc:date>
    <item>
      <title>SQL - Insert List from JSL to SQL Query</title>
      <link>https://community.jmp.com/t5/Discussions/SQL-Insert-List-from-JSL-to-SQL-Query/m-p/63445#M34001</link>
      <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&amp;nbsp;OK job explaining my problems but if i haven't please ask for clarification.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// 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( &amp;lt;db_connection&amp;gt;, testdata_HAY_Q_LotList, "LotList", Invisible );
Summarize( LotList = By (:wafer_number ));
Insert Into( LotList, "&amp;lt;Select Lot&amp;gt;", 1);
Close (dt_lotlist, No Save);

// Choose Your Lot

doListChoice = expr(
	SelectedLot = LotListBox &amp;lt;&amp;lt; getSelected;
	show(SelectedLot);
);

//LotListBox = ComboBox(LotList, doListChoice); // used to insert single lot

LotListBox = CheckBox(LotList, doListChoice);

win = New Window( "DataBase",
//	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;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 &amp;lt;&amp;lt; Close Window),
		)
	)
);

// Attempt to pass multiple lots to SQL query 
LotListSQLString = SelectedLot[1];
for(i = 2, i&amp;lt;= N Items(SelectedLot), i++, LotListSQLString = (LotListSQLString||",'"||Char(SelectedLot[i])||"'") );
Show(LotListSQLString);


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jul 2018 17:18:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SQL-Insert-List-from-JSL-to-SQL-Query/m-p/63445#M34001</guid>
      <dc:creator>Yngeinstn</dc:creator>
      <dc:date>2018-07-19T17:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL - Insert List from JSL to SQL Query</title>
      <link>https://community.jmp.com/t5/Discussions/SQL-Insert-List-from-JSL-to-SQL-Query/m-p/64738#M34252</link>
      <description>Did I miss something?</description>
      <pubDate>Sun, 29 Jul 2018 15:40:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/SQL-Insert-List-from-JSL-to-SQL-Query/m-p/64738#M34252</guid>
      <dc:creator>Yngeinstn</dc:creator>
      <dc:date>2018-07-29T15:40:19Z</dc:date>
    </item>
  </channel>
</rss>

